Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use MedicalLogicModule to represent compiled MLM; use separate class …

…that gets instanciated for every execution.

git-svn-id: https://elmar.ips.cs.tu-bs.de/svn/arden2bytecode/trunk@4 20415b1c-3eea-de11-af57-000476a39db3
  • Loading branch information...
commit 35de2552b5d6bede9ed7db2a3ef8e8955c90821c 1 parent b5d4c48
@dgrunwald authored
View
260 .settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Dec 17 13:52:46 CET 2009
+#Wed Dec 23 16:26:41 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
@@ -10,3 +10,261 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
View
4 .settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Wed Dec 23 16:26:40 CET 2009
+eclipse.preferences.version=1
+formatter_profile=_MyProfile
+formatter_settings_version=11
View
11 src/README
@@ -0,0 +1,11 @@
+License: GPL (because arden.scc is GPL)
+
+
+To compile the parser in Eclipse:
+ 1. Create an external tool configuration:
+ Location: javaw.exe (from your Java runtime)
+ Working directory: ${container_loc}
+ Arguments: -classpath ${project_loc}\tools\sablecc.jar org.sablecc.sablecc.SableCC ${resource_name}
+
+ 2. Select the file "arden.scc" and run SableCC.
+ 3. Right-click "src" and press Refresh so that Eclipse loads the generated files.
View
9 src/arden/codegenerator/ClassFileLimitExceededException.java
@@ -1,11 +1,10 @@
package arden.codegenerator;
/**
- * Diese Exception tritt auf, wenn eines der Limits des Class-File-Formates zu
- * überschreiten.
- *
- * @author daniel
+ * This exceptions occurs when one of the limits of the .class file format is
+ * exceeded.
*
+ * @author Daniel Grunwald
*/
public class ClassFileLimitExceededException extends RuntimeException {
@@ -17,7 +16,7 @@ public ClassFileLimitExceededException() {
public ClassFileLimitExceededException(String message) {
super(message);
}
-
+
public ClassFileLimitExceededException(Exception inner) {
super(inner);
}
View
6 src/arden/codegenerator/ClassFileWriter.java
@@ -11,8 +11,7 @@
/**
* Class for writing .class files
*
- * @author daniel
- *
+ * @author Daniel Grunwald
*/
public class ClassFileWriter {
ConstantPool pool = new ConstantPool();
@@ -122,8 +121,7 @@ public MethodWriter createStaticInitializer() {
/** Saves the class file to disk */
public void save(String filename) throws IOException {
- DataOutputStream s = new DataOutputStream(
- new FileOutputStream(filename));
+ DataOutputStream s = new DataOutputStream(new FileOutputStream(filename));
try {
save(s);
} finally {
View
105 src/arden/codegenerator/ConstantPool.java
@@ -11,10 +11,9 @@
import java.util.HashMap;
/**
- * Repräsentiert den ConstantPool in einer Java .class-Datei
- *
- * @author daniel
+ * Represents the constant pool inside a Java class file.
*
+ * @author Daniel Grunwald
*/
public class ConstantPool {
static final byte CONSTANT_Class = 7;
@@ -45,15 +44,17 @@
private ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
private DataOutputStream data = new DataOutputStream(byteOutputStream);
- // gets the index for the new constant pool entry being created
+ /** gets the index for the new constant pool entry being created */
private int getNextIndex() {
if (elementNumber >= 65534)
throw new ClassFileLimitExceededException("Too many constants.");
return ++elementNumber;
}
- // gets the index for the new constant pool entry being created for a double
- // or long value
+ /**
+ * gets the index for the new constant pool entry being created for a double
+ * or long value
+ */
private int getNextDoubleIndex() {
int index = getNextIndex();
if (elementNumber >= 65534)
@@ -62,7 +63,7 @@ private int getNextDoubleIndex() {
return index;
}
- /** Speichert den ConstantPool in die .class-Datei */
+ /** Saves the ConstantPool into a .class-file */
public void save(DataOutput output) throws IOException {
data.flush(); // ensure the DataOutputStream writes everything to the
// ByteArrayOutputStream
@@ -71,11 +72,11 @@ public void save(DataOutput output) throws IOException {
}
/**
- * Findet einen vorhandenen Integer-Eintrag oder erstellt einen neuen.
+ * Finds an existing Integer-entry or creates a new entry.
*
* @param value
- * Der Wert des integers
- * @return Nummer des Integer-Eintrages
+ * The value of the entry.
+ * @return The index of the entry.
*/
public int getInteger(Integer value) {
if (integer_map.containsKey(value))
@@ -92,11 +93,11 @@ public int getInteger(Integer value) {
}
/**
- * Findet einen vorhandenen Double-Eintrag oder erstellt einen neuen.
+ * Finds an existing Double-entry or creates a new entry.
*
* @param value
- * Der Wert des doubles
- * @return Nummer des Double-Eintrages
+ * The value of the entry.
+ * @return The index of the entry.
*/
public int getDouble(Double value) {
if (double_map.containsKey(value))
@@ -113,11 +114,11 @@ public int getDouble(Double value) {
}
/**
- * Findet einen vorhandenen Long-Eintrag oder erstellt einen neuen.
+ * Finds an existing Long-entry or creates a new entry.
*
* @param value
- * Der Wert des longs
- * @return Nummer des Long-Eintrages
+ * The value of the entry.
+ * @return The index of the entry.
*/
public int getLong(Long value) {
if (long_map.containsKey(value))
@@ -134,11 +135,11 @@ public int getLong(Long value) {
}
/**
- * Findet einen vorhandenen Utf8-Eintrag oder erstellt einen neuen.
+ * Finds an existing Utf8-entry or creates a new entry.
*
- * @param text
- * Der Text des Eintrages
- * @return Nummer des Utf8-Eintrages
+ * @param value
+ * The value of the entry.
+ * @return The index of the entry.
*/
public int getUtf8(String text) {
if (utf8_map.containsKey(text))
@@ -158,11 +159,11 @@ public int getUtf8(String text) {
}
/**
- * Findet einen vorhandenen String-Eintrag oder erstellt einen neuen.
+ * Finds an existing String-entry or creates a new entry.
*
- * @param text
- * Der Text des Eintrages
- * @return Nummer des String-Eintrages
+ * @param value
+ * The value of the entry.
+ * @return The index of the entry.
*/
public int getString(String text) {
if (string_map.containsKey(text))
@@ -180,12 +181,11 @@ public int getString(String text) {
}
/**
- * Findet einen vorhandenen Class-Eintrag oder erstellt einen neuen.
+ * Finds an existing Class-entry or creates a new entry.
*
* @param classSym
- * Das Klassen-Symbol, für das der Class-Eintrag erstellt werden
- * soll
- * @return Nummer des Class-Eintrages
+ * The target class.
+ * @return Index of the Class-entry.
*/
public int getClass(Class<?> classSym) {
if (classSym == null)
@@ -194,14 +194,13 @@ public int getClass(Class<?> classSym) {
}
/**
- * Findet einen vorhandenen Class-Eintrag für einen Array-Typen oder
- * erstellt einen neuen.
+ * Finds an existing Class-entry for an array type or creates a new entry.
*
* @param elementType
- * Der Elementtyp des Arrays
+ * The array element type
* @param arrayNestingLevel
- * Verschachtelungstiefe des Arrays
- * @return Nummer des Class-Eintrages
+ * Nesting level of the array
+ * @return Index of the Class-entry
*/
public int getClass(Class<?> elementType, int arrayNestingLevel) {
if (elementType == null)
@@ -215,7 +214,7 @@ public int getClass(Class<?> elementType, int arrayNestingLevel) {
return getClassByJavaName(b.toString());
}
- /** Ermittelt den Java-Namen der Klasse */
+ /** Calculates the internal Java name of the class */
static String getInternalJavaName(Class<?> classSym) {
if (classSym.isArray() || classSym.isPrimitive())
throw new IllegalArgumentException("Cannot use array classes or primitive classes");
@@ -223,12 +222,12 @@ static String getInternalJavaName(Class<?> classSym) {
}
/**
- * Findet einen vorhandenen Class-Eintrag für einen Typen oder erstellt
- * einen neuen.
+ * Finds an existing Class-entry or creates a new entry.
*
* @param internalJavaName
- * Der interne Java-Name des Typen (z.B. '[Lopa/runtime/Object;')
- * @return Nummer des Class-Eintrages
+ * The internal Java name of the Type (e.g.
+ * '[Ljava/lang/Object;')
+ * @return Index of the Class-entry.
*/
public int getClassByJavaName(String internalJavaName) {
if (class_map.containsKey(internalJavaName))
@@ -246,11 +245,11 @@ public int getClassByJavaName(String internalJavaName) {
}
/**
- * Findet einen vorhandenen Fieldref-Eintrag oder erstellt einen neuen.
+ * Finds an existing Fieldref-entry or creates a new entry.
*
* @param field
- * Das Feld, für das der Fieldref-Eintrag erstellt werden soll
- * @return Nummer des Fieldref-Eintrages
+ * The target Field.
+ * @return Index of the Fieldref-Entry
*/
public FieldReference getFieldref(Field field) {
if (field == null)
@@ -307,11 +306,11 @@ else if (type.equals(Boolean.TYPE))
}
/**
- * Findet einen vorhandenen Methodref-Eintrag oder erstellt einen neuen.
+ * Finds an existing Methodref-entry or creates a new entry.
*
* @param method
- * Das Feld, für das der Methodref-Eintrag erstellt werden soll
- * @return Nummer des Methodref-Eintrages
+ * The target method.
+ * @return Index of the Methodref-entry.
*/
public int getMethodref(Method method) {
if (method == null)
@@ -319,7 +318,8 @@ public int getMethodref(Method method) {
if (methodref_map.containsKey(method))
return methodref_map.get(method);
int classRef = getClass(method.getDeclaringClass());
- int natRef = getNameAndType(method.getName(), createMethodDescriptor(method.getParameterTypes(), method.getReturnType()));
+ int natRef = getNameAndType(method.getName(), createMethodDescriptor(method.getParameterTypes(), method
+ .getReturnType()));
int index = getNextIndex();
methodref_map.put(method, index);
try {
@@ -347,12 +347,11 @@ static String createMethodDescriptor(Class<?>[] parameters, Class<?> returnType)
}
/**
- * Findet die Methodref für den Java-Konstruktor, der aus einem Java Wert
- * einen OPA-Runtimeobjekt macht
+ * Finds an existing Method-entry for a constructor or creates a new entry.
*
* @param ctor
- * Der Konstruktor.
- * @return Nummer des Eintrags im Constant-Pool
+ * The target constructor.
+ * @return Index of the entry
*/
public int getConstructor(Constructor<?> ctor) {
if (constructor_map.containsKey(ctor))
@@ -372,14 +371,14 @@ public int getConstructor(Constructor<?> ctor) {
}
/**
- * Findet einen vorhandenen NameAndType-Eintrag oder erstellt einen neuen.
+ * Finds an existing NameAndType-entry or creates a new entry.
*
* @param name
- * Der Name des NameAndType-Eintrages
+ * The name of the entry
* @param typeDescriptor
- * Der Typ des Eintrages (Java FieldDescriptor oder
+ * The type of the entry (Java FieldDescriptor or
* MethodDescriptor)
- * @return Nummer des NameAndType-Eintrages
+ * @return Index of the entry
*/
public int getNameAndType(String name, String typeDescriptor) {
NameTypePair ntp = new NameTypePair(name, typeDescriptor);
View
6 src/arden/codegenerator/FieldReference.java
@@ -1,6 +1,10 @@
package arden.codegenerator;
-/** Represents a field referenced in the constant pool. */
+/**
+ * Represents a field referenced in the constant pool.
+ *
+ * @author Daniel Grunwald
+ */
public class FieldReference {
final int index;
View
21 src/arden/codegenerator/Label.java
@@ -1,23 +1,22 @@
package arden.codegenerator;
/**
- * Repräsentiert eine Sprungmarke im Bytecode.
+ * Represents a jump label inside the byte code.
*
- * Verwendung: <br>
- * {@code Label marke = new Label(); } <br>
- * {@code methodWriter.jump(marke); // Springe vorwärts (zu noch nicht definierter
- * Marke) } <br>
- * {@code ... // Generiere mehr Code } <br>
- * {@code methodWriter.mark(marke); // Plaziere Sprungmarke }
+ * Usage: <br>
+ * {@code Label label = new Label(); } <br>
+ * {@code methodWriter.jump(label); // Jump forwards (target label not yet defined) } <br>
+ * {@code ... // generate more Code } <br>
+ * {@code methodWriter.mark(label); // Place jump label }
*
- * @author daniel
+ * @author Daniel Grunwald
*
*/
public class Label {
- /** Zielposition, auf die das Label zeigt, -1=noch nicht gesetzt */
+ /** Target position (byte index where the label is pointing to), -1=not yet set */
int markedPosition = -1;
- /** Stackgröße an Zielposition, -1=noch unbekannt */
+ /** Stack size at target position, -1=currently unknown */
int stackSize = -1;
- /** Am Anfang true, wird von markForwardOnly() auf false gesetzt um zu signalisieren, dass Rücksprünge verboten sind */
+ /** Initially true, is set to false by markForwardOnly() to signal that backward jumps are forbidden */
boolean allowJumps = true;
}
View
13 src/arden/codegenerator/LabelReference.java
@@ -1,15 +1,22 @@
package arden.codegenerator;
+/**
+ * Used internally by MethodWriter to resolve offsets between Labels. Represents
+ * a place in the byte code that references a label (e.g. parameter of jump
+ * instructions).
+ *
+ * @author Daniel Grunwald
+ */
class LabelReference {
/** the position of the first byte of the jump offset */
final int referencePosition;
/** the base position (start position of the jump instruction) */
final int basePosition;
-
+
final Label label;
-
+
final boolean is32BitOffset;
-
+
public LabelReference(int referencePosition, int basePosition, Label label, boolean is32BitOffset) {
this.referencePosition = referencePosition;
this.basePosition = basePosition;
View
4 src/arden/codegenerator/LineNumberTable.java
@@ -6,9 +6,9 @@
import java.util.ArrayList;
/**
- * Speichert Zeilennummern für Exception Stacktraces/Debugger.
+ * Stores line numbers for exception stacktrace/debugger.
*
- * @author daniel
+ * @author Daniel Grunwald
*
*/
class LineNumberTable {
View
11 src/arden/codegenerator/LocalVariableTable.java
@@ -6,20 +6,19 @@
import java.util.ArrayList;
/**
- * Speichert Variablennamen für Debugger.
+ * Stores variable names for debuggers.
*
- * @author daniel
+ * @author Daniel Grunwald
*
*/
class LocalVariableTable {
final int attributeNameIndex;
private final ConstantPool pool;
private ArrayList<LocalVariable> variables = new ArrayList<LocalVariable>();
-
- static class LocalVariable
- {
+
+ static class LocalVariable {
int index, nameIndex, descriptorIndex;
-
+
public LocalVariable(int index, int nameIndex, int descriptorIndex) {
this.index = index;
this.nameIndex = nameIndex;
View
166 src/arden/codegenerator/MethodWriter.java
@@ -10,47 +10,53 @@
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+/**
+ * This class is used for emitting the byte code in the body of methods.
+ *
+ * @author Daniel Grunwald
+ *
+ */
public class MethodWriter {
- /** ConstantPool für Methoden- und Feldreferenzen */
+ /** ConstantPool for method- and field references */
private ConstantPool pool;
- /** Line number table, falls Positionsinformationen ausgegeben werden sollen */
+ /** Line number table, used if debugging information should be output */
private LineNumberTable lineNumberTable;
- /** Tabelle von lokalen Variablen, für Debugger */
+ /** Table of local variables (for use by debuggers) */
private LocalVariableTable localVariableTable;
- /** OutputStream, in den der Bytecode geschrieben wird */
+ /** OutputStream: all byte code is written here */
private ByteArrayOutputStream byteCodeOutputStream = new ByteArrayOutputStream();
- /** DataOutputStream zum Schreiben des Bytecodes in den byteCodeOutputStream */
- private DataOutputStream byteCode = new DataOutputStream(
- byteCodeOutputStream);
+
+ /** DataOutputStream that wraps the byteCodeOutputStream */
+ private DataOutputStream byteCode = new DataOutputStream(byteCodeOutputStream);
private boolean isInstanceMethod;
-
- /**
- * Speichert Positionen, an denen das Ziel von Labels eingesetzt werden muss
- */
+
+ /** Stores positions, where the target of labels has to be placed. */
private ArrayList<LabelReference> labelReferences = new ArrayList<LabelReference>();
- /** Anzahl lokaler Variablen inklusiv Parameter und 'this' */
+ /** Number of local variables including parameters and 'this' */
private int numLocals;
+
/**
- * Aktuelle Stackgröße.
+ * Current stack size.
*
- * Jede erzeugte Anweisung passt diesen Wert durch einen Aufruf von poppush
- * an, so dass immer die aktuelle Größe des Java-Stacks bekannt ist. Nach
- * unbedingten Sprunganweisungen ist die Stackgröße unbekannt (durch -1
- * dargestellt). Dann muss zunächst die Stackgröße von einer Sprungmarke
- * übernommen werden (durch einen mark()-Aufruf), bevor wieder Code
- * generiert werden kann.
+ * Every instruction being emitted will adjust this value by calling
+ * poppush, so that the current size of the Java stack is known. After
+ * unconditional jump instructions the stack size is unknown, this is
+ * represented using the value -1. In this case, the stack size must be
+ * inferred from a jump mark (by calling mark()) before additional
+ * instructions can be emitted.
*/
private int stackSize;
- /** Maximale Stackgröße */
+
+ /** Maximum stack size that was observed so far */
private int maxStackSize;
/**
- * MethodWriter constructor.
+ * MethodWriter constructor.
*/
public MethodWriter(ConstantPool pool, boolean isInstanceMethod) {
this.pool = pool;
@@ -58,7 +64,7 @@ public MethodWriter(ConstantPool pool, boolean isInstanceMethod) {
this.numLocals = isInstanceMethod ? 1 : 0;
}
- /** Passt stackSize für eine Operation an (um maxStackSize zu ermitteln) */
+ /** Adjusts stackSize for one operation (to calculate maxStackSize) */
private void poppush(int popsize, int pushsize) {
if (stackSize == -1) {
// Code is unreachable.
@@ -76,7 +82,7 @@ private void poppush(int popsize, int pushsize) {
}
}
- /** Gibt ein Byte (0-255) in den Bytecode aus. */
+ /** Emits one byte (0-255) into the byte code. */
private void emit(int b) {
if (b < 0 || b > 255)
throw new IllegalArgumentException("Number out of range");
@@ -89,7 +95,7 @@ private void emit(int b) {
}
}
- /** Gibt ein signed Byte (-128 bis 127) in den Bytecode aus. */
+ /** Emits a signed byte (-128 to 127) into the byte code. */
private void emitInt8(int b) {
if (b < Byte.MIN_VALUE || b > Byte.MAX_VALUE)
throw new IllegalArgumentException("Number out of range");
@@ -102,7 +108,7 @@ private void emitInt8(int b) {
}
}
- /** Gibt einen unsigned short in den Bytecode aus. */
+ /** Emits an unsigned short into the byte code. */
private void emitUInt16(int num) {
if (num < 0 || num > 65535)
throw new IllegalArgumentException("Number out of range");
@@ -115,7 +121,7 @@ private void emitUInt16(int num) {
}
}
- /** Gibt ein signed short in den Bytecode aus. */
+ /** Emits a signed short into the byte code. */
private void emitInt16(int num) {
if (num < -32768 || num > 32767)
throw new IllegalArgumentException("Number out of range");
@@ -128,6 +134,7 @@ private void emitInt16(int num) {
}
}
+ /** Emits an int into the byte code. */
private void emitInt32(int num) {
if (stackSize == -1)
return; // don't emit unreachable code
@@ -138,32 +145,30 @@ private void emitInt32(int num) {
}
}
- /** Gibt die aktuelle Position im Bytecode zurück */
+ /** Returns the current position in the byte code */
private int getCurrentPosition() {
return byteCode.size();
}
- /** Gibt die Zieladdresse eines Labels aus. */
+ /** Emits the target location of a label (16-bit offset) */
private void emitLabelReference(Label label, int basePosition) {
if (checkLabel(label)) {
int referencePosition = getCurrentPosition();
- // erstmal nur Platzhalter ausgeben
+ // emit place holder
emitUInt16(0);
- // Position merken, um Label-Ziel später einzutragen
- labelReferences.add(new LabelReference(referencePosition,
- basePosition, label, false));
+ // remember position, to fill in the actual target later
+ labelReferences.add(new LabelReference(referencePosition, basePosition, label, false));
}
}
- /** Gibt die Zieladdresse eines Labels aus. */
+ /** Emits the target location of a label (32-bit offset) */
private void emitLabelReference32(Label label, int basePosition) {
if (checkLabel(label)) {
int referencePosition = getCurrentPosition();
- // erstmal nur Platzhalter ausgeben
+ // emit place holder
emitInt32(0);
- // Position merken, um Label-Ziel später einzutragen
- labelReferences.add(new LabelReference(referencePosition,
- basePosition, label, true));
+ // remember position, to fill in the actual target later
+ labelReferences.add(new LabelReference(referencePosition, basePosition, label, true));
}
}
@@ -173,25 +178,21 @@ private boolean checkLabel(Label label) {
if (stackSize == -1)
return false; // don't emit unreachable code
if (!label.allowJumps)
- throw new IllegalArgumentException(
- "Cannot emit backward jump to forward-only label.");
+ throw new IllegalArgumentException("Cannot emit backward jump to forward-only label.");
if (label.stackSize == -1)
label.stackSize = stackSize;
else if (label.stackSize != stackSize)
- throw new IllegalArgumentException(
- "All paths reaching a label must result in the same stack size.");
+ throw new IllegalArgumentException("All paths reaching a label must result in the same stack size.");
return true;
}
/**
- * Trägt die Zieladdressen von Labels in die dafür vorgesehenen Platzhalter
- * ein.
+ * Fills in the target addresses of all labels into the place holders.
*/
private void resolveLabels(byte[] byteCode) {
for (LabelReference labelRef : labelReferences) {
if (labelRef.label.markedPosition < 0)
- throw new IllegalStateException(
- "Cannot resolve label - did you use a label without calling mark()?");
+ throw new IllegalStateException("Cannot resolve label - did you use a label without calling mark()?");
int offset = labelRef.label.markedPosition - labelRef.basePosition;
if (labelRef.is32BitOffset) {
byteCode[labelRef.referencePosition] = (byte) (offset >>> 24);
@@ -200,8 +201,7 @@ private void resolveLabels(byte[] byteCode) {
byteCode[labelRef.referencePosition + 3] = (byte) (offset & 0xff);
} else {
if (offset < Short.MIN_VALUE || offset > Short.MAX_VALUE)
- throw new ClassFileLimitExceededException(
- "Branch distance too large.");
+ throw new ClassFileLimitExceededException("Branch distance too large.");
byteCode[labelRef.referencePosition] = (byte) ((short) offset >>> 8);
byteCode[labelRef.referencePosition + 1] = (byte) (offset & 0xff);
}
@@ -209,7 +209,7 @@ private void resolveLabels(byte[] byteCode) {
labelReferences.clear();
}
- /** Gibt den bisher erzeugten Bytecode zurück. */
+ /** Returns the emitted byte code. */
public byte[] getByteCode() {
try {
byteCode.flush();
@@ -224,8 +224,8 @@ private void resolveLabels(byte[] byteCode) {
}
/**
- * Gibt den Inhalt des "Code" Attributes zurück. Dieses enthält den Bytecode
- * sowie einige Zusatzdaten (maxStackSize etc.)
+ * Returns the content of the "Code" attribute. This contains the byte code
+ * and some additional data (maxStackSize etc.)
*/
public byte[] getCodeAttributeData() {
try {
@@ -263,13 +263,11 @@ private void resolveLabels(byte[] byteCode) {
}
/**
- * Aktiviert die Zeilennummertabelle, in der Sequenzpunkte für Debugger
- * gespeichert werden.
+ * Enables the LineNumberTable, which stores sequence points for debuggers.
*/
public void enableLineNumberTable() {
if (lineNumberTable != null)
- throw new IllegalStateException(
- "Line number table is already enabled.");
+ throw new IllegalStateException("Line number table is already enabled.");
lineNumberTable = new LineNumberTable(pool);
}
@@ -290,8 +288,7 @@ public void defineLocalVariable(int vindex, String name, Class<?> type) {
*/
public void sequencePoint(int lineNumber) {
if (stackSize > 0)
- throw new IllegalStateException(
- "Expecting empty stack at start of statement.");
+ throw new IllegalStateException("Expecting empty stack at start of statement.");
if (lineNumberTable != null)
lineNumberTable.addEntry(byteCode.size(), lineNumber);
}
@@ -322,7 +319,7 @@ public void loadIntegerConstant(int val) {
emitLdc(pool.getInteger(val));
}
}
-
+
/**
* Legt einen konstanten String auf den Stack (ohne Wrapper-Klasse).
*
@@ -336,7 +333,7 @@ public void loadStringConstant(String val) {
emitLdc(pool.getString(val));
}
}
-
+
/**
* Legt einen konstanten Double auf den Stack (ohne Wrapper-Klasse).
*
@@ -353,7 +350,7 @@ public void loadDoubleConstant(double val) {
emitUInt16(pool.getDouble(val));
}
}
-
+
/**
* Legt einen konstanten Long auf den Stack (ohne Wrapper-Klasse).
*
@@ -370,7 +367,7 @@ public void loadLongConstant(long val) {
emitUInt16(pool.getLong(val));
}
}
-
+
/**
* Legt die null-Referenz auf den Stack.
*
@@ -388,8 +385,7 @@ public void loadNull() {
*/
public void loadThis() {
if (isInstanceMethod)
- throw new IllegalArgumentException(
- "Cannot load 'this' in static method.");
+ throw new IllegalArgumentException("Cannot load 'this' in static method.");
loadVariable(0);
}
@@ -422,7 +418,7 @@ public void loadVariable(int vindex) {
emitUInt16(vindex);
}
}
-
+
/**
* Legt den Wert einer primitven int-Variablen auf den Stack.
*
@@ -464,7 +460,8 @@ public void storeVariable(int vindex) {
}
/**
- * Speichert einen primitiven int-Wert vom Stack in der angegebenen Variablen.
+ * Speichert einen primitiven int-Wert vom Stack in der angegebenen
+ * Variablen.
*
* Stack: .., wert => ..
*/
@@ -642,18 +639,16 @@ public void jumpIfReferenceNotEqual(Label label) {
* @param defaultLabel
* Das default-Label
*
- * Stack: .., int => ..
+ * Stack: .., int => ..
*/
public void lookupSwitch(int[] constantValues, Label[] targetLabels, Label defaultLabel) {
if (constantValues.length != targetLabels.length)
- throw new IllegalArgumentException(
- "Values and label arrays must have same length");
+ throw new IllegalArgumentException("Values and label arrays must have same length");
if (constantValues.length == 0)
throw new IllegalArgumentException("Empty switch not supported");
for (int i = 0; i < constantValues.length; i++) {
if (i > 0 && constantValues[i - 1] >= constantValues[i])
- throw new IllegalArgumentException(
- "Constants are not sorted/duplicate constant");
+ throw new IllegalArgumentException("Constants are not sorted/duplicate constant");
}
poppush(1, 0);
int basePosition = getCurrentPosition();
@@ -698,13 +693,11 @@ public void markForwardJumpsOnly(Label label) {
} else {
if (stackSize != label.stackSize)
throw new IllegalArgumentException(
- "Label cannot be placed here: A jump to this position expects stack size"
- + label.stackSize + ", but stack size is "
- + stackSize);
+ "Label cannot be placed here: A jump to this position expects stack size" + label.stackSize
+ + ", but stack size is " + stackSize);
}
} else {
- throw new IllegalArgumentException(
- "The label already was used to mark a position.");
+ throw new IllegalArgumentException("The label already was used to mark a position.");
}
}
@@ -718,8 +711,7 @@ public void mark(Label label) {
label.markedPosition = getCurrentPosition();
if (stackSize > 0)
throw new IllegalArgumentException(
- "Label cannot be placed here: Stack must be empty at label position, but has size "
- + stackSize);
+ "Label cannot be placed here: Stack must be empty at label position, but has size " + stackSize);
if (label.stackSize > 0)
throw new IllegalArgumentException(
"Label cannot be placed here: Stack must be empty during jump, but there is a jump source with stack size "
@@ -727,8 +719,7 @@ public void mark(Label label) {
stackSize = 0;
label.stackSize = 0;
} else {
- throw new IllegalArgumentException(
- "The label already was used to mark a position.");
+ throw new IllegalArgumentException("The label already was used to mark a position.");
}
}
@@ -759,7 +750,7 @@ public void loadInstanceField(Field field) {
throw new IllegalArgumentException("Expected instance field, but found static field.");
loadInstanceField(pool.getFieldref(field));
}
-
+
public void loadInstanceField(FieldReference field) {
poppush(1, 1);
emit(180); // getfield
@@ -776,7 +767,7 @@ public void storeInstanceField(Field field) {
throw new IllegalArgumentException("Expected instance field, but found static field.");
storeInstanceField(pool.getFieldref(field));
}
-
+
public void storeInstanceField(FieldReference field) {
poppush(2, 0);
emit(181); // putfield
@@ -793,7 +784,7 @@ public void loadStaticField(Field field) {
throw new IllegalArgumentException("Expected static field, but found instance field.");
loadStaticField(pool.getFieldref(field));
}
-
+
public void loadStaticField(FieldReference field) {
poppush(0, 1);
emit(178); // getstatic
@@ -810,6 +801,7 @@ public void storeStaticField(Field field) {
throw new IllegalArgumentException("Expected static field, but found instance field.");
storeStaticField(pool.getFieldref(field));
}
+
public void storeStaticField(FieldReference field) {
poppush(1, 0);
emit(179); // putstatic
@@ -839,8 +831,7 @@ static int getStackSize(Class<?>[] types) {
*/
public void invokeInstance(Method method) {
if (isStatic(method))
- throw new IllegalArgumentException(
- "Cannot use invokeInstance for static method");
+ throw new IllegalArgumentException("Cannot use invokeInstance for static method");
poppush(1 + getStackSize(method.getParameterTypes()), getStackSize(method.getReturnType()));
emit(182); // invokevirtual
emitUInt16(pool.getMethodref(method));
@@ -853,15 +844,13 @@ public void invokeInstance(Method method) {
*/
public void invokeStatic(Method method) {
if (!isStatic(method))
- throw new IllegalArgumentException(
- "Cannot use invokeStatic for instance method");
+ throw new IllegalArgumentException("Cannot use invokeStatic for instance method");
poppush(getStackSize(method.getParameterTypes()), getStackSize(method.getReturnType()));
emit(184); // invokestatic
emitUInt16(pool.getMethodref(method));
}
- private boolean isStatic(Member member)
- {
+ private boolean isStatic(Member member) {
return (member.getModifiers() & Modifier.STATIC) == Modifier.STATIC;
}
@@ -881,8 +870,7 @@ public void newObject(Class<?> type) {
*
* Stack: .., objectref, parameters => ..
*/
- public void invokeConstructor(Constructor<?> ctor)
- {
+ public void invokeConstructor(Constructor<?> ctor) {
poppush(1 + getStackSize(ctor.getParameterTypes()), 0);
emit(183); // invokespecial
emitUInt16(pool.getConstructor(ctor));
View
51 src/arden/compiler/Compiler.java
@@ -1,6 +1,8 @@
package arden.compiler;
+import java.io.ByteArrayOutputStream;
import java.io.DataOutput;
+import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.util.HashMap;
@@ -10,9 +12,16 @@
import arden.codegenerator.MethodWriter;
import arden.runtime.ArdenNumber;
import arden.runtime.ArdenString;
-import arden.runtime.MedicalLogicModule;
+import arden.runtime.MedicalLogicModuleImplementation;
+/**
+ * This class is responsible for generating the
+ * MedicalLogicModuleImplementation-derived class.
+ *
+ * @author Daniel Grunwald
+ */
public class Compiler {
+ private String className;
private ClassFileWriter classFileWriter;
private MethodWriter staticInitializer;
private HashMap<String, FieldReference> stringLiterals = new HashMap<String, FieldReference>();
@@ -34,16 +43,14 @@ public FieldReference getStringLiteral(String value) {
try {
FieldReference ref = stringLiterals.get(value);
if (ref == null) {
- ref = classFileWriter.declareField("literal"
- + (nextFieldIndex++), ArdenString.class,
- Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL);
+ ref = classFileWriter.declareField("literal" + (nextFieldIndex++), ArdenString.class, Modifier.PRIVATE
+ | Modifier.STATIC | Modifier.FINAL);
stringLiterals.put(value, ref);
getStaticInitializer().newObject(ArdenString.class);
getStaticInitializer().dup();
getStaticInitializer().loadStringConstant(value);
- getStaticInitializer().invokeConstructor(
- ArdenString.class.getConstructor(String.class));
+ getStaticInitializer().invokeConstructor(ArdenString.class.getConstructor(String.class));
getStaticInitializer().storeStaticField(ref);
}
@@ -63,16 +70,14 @@ public FieldReference getNumberLiteral(double value) {
try {
FieldReference ref = numberLiterals.get(value);
if (ref == null) {
- ref = classFileWriter.declareField("literal"
- + (nextFieldIndex++), ArdenNumber.class,
- Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL);
+ ref = classFileWriter.declareField("literal" + (nextFieldIndex++), ArdenNumber.class, Modifier.PRIVATE
+ | Modifier.STATIC | Modifier.FINAL);
numberLiterals.put(value, ref);
getStaticInitializer().newObject(ArdenNumber.class);
getStaticInitializer().dup();
getStaticInitializer().loadDoubleConstant(value);
- getStaticInitializer().invokeConstructor(
- ArdenNumber.class.getConstructor(Double.TYPE));
+ getStaticInitializer().invokeConstructor(ArdenNumber.class.getConstructor(Double.TYPE));
getStaticInitializer().storeStaticField(ref);
}
@@ -85,11 +90,33 @@ public FieldReference getNumberLiteral(double value) {
}
public Compiler(String mlmName) {
- classFileWriter = new ClassFileWriter(mlmName, MedicalLogicModule.class);
+ this.className = mlmName;
+ this.classFileWriter = new ClassFileWriter(mlmName, MedicalLogicModuleImplementation.class);
}
/** Saves the class file */
public void save(DataOutput output) throws IOException {
classFileWriter.save(output);
}
+
+ /** Loads the Java class. */
+ @SuppressWarnings("unchecked")
+ public Class<? extends MedicalLogicModuleImplementation> loadClassFromMemory() {
+ byte[] data;
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ DataOutputStream s = new DataOutputStream(bos);
+ classFileWriter.save(s);
+ s.close();
+ data = bos.toByteArray();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ try {
+ ClassLoader classLoader = new InMemoryClassLoader(className, data);
+ return (Class<? extends MedicalLogicModuleImplementation>) classLoader.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
View
30 src/arden/compiler/InMemoryClassLoader.java
@@ -0,0 +1,30 @@
+package arden.compiler;
+
+/**
+ * ClassLoader used for loading the compiled classes without having to save them
+ * to disk.
+ *
+ * @author Daniel Grunwald
+ */
+class InMemoryClassLoader extends ClassLoader {
+ String className;
+ byte[] data;
+ Class<?> loadedClass;
+
+ public InMemoryClassLoader(String className, byte[] data) {
+ this.className = className;
+ this.data = data;
+ }
+
+ protected synchronized Class<?> findClass(String name) throws ClassNotFoundException {
+ if (className.equals(name)) {
+ if (loadedClass == null) {
+ loadedClass = defineClass(name, data, 0, data.length);
+ data = null;
+ }
+ return loadedClass;
+ } else {
+ throw new ClassNotFoundException();
+ }
+ }
+}
View
8 src/arden/runtime/ExecutionContext.java
@@ -1,9 +1,15 @@
package arden.runtime;
+/**
+ * Describes the environment in which a Medical Logic Module is executed.
+ *
+ * @author Daniel Grunwald
+ *
+ */
public interface ExecutionContext {
// query = "medication_cancellation where class = gentamicin"
ArdenValue read(String query);
-
+
// called by write statements
void write(String message);
}
View
46 src/arden/runtime/MedicalLogicModule.java
@@ -1,6 +1,46 @@
package arden.runtime;
-public abstract class MedicalLogicModule {
- public abstract boolean logic();
- public abstract void action();
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Represents a compiled medical logic module.
+ *
+ * @author Daniel Grunwald
+ */
+public class MedicalLogicModule {
+ Class<? extends MedicalLogicModuleImplementation> clazz;
+
+ public MedicalLogicModule(Class<? extends MedicalLogicModuleImplementation> clazz) {
+ if (clazz == null)
+ throw new IllegalArgumentException();
+ this.clazz = clazz;
+ }
+
+ /** Creates an instance of the implementation class. */
+ public MedicalLogicModuleImplementation createInstance(ExecutionContext context) throws InvocationTargetException {
+ if (context == null)
+ throw new IllegalArgumentException();
+
+ // We know the class has an appropriate constructor because we compiled
+ // it,
+ // so wrap all the checked exceptions that should never occur.
+ Constructor<? extends MedicalLogicModuleImplementation> ctor;
+ try {
+ ctor = clazz.getConstructor(ExecutionContext.class);
+ } catch (SecurityException e) {
+ throw new RuntimeException(e);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ try {
+ return ctor.newInstance(context);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
View
17 src/arden/runtime/MedicalLogicModuleImplementation.java
@@ -0,0 +1,17 @@
+package arden.runtime;
+
+/**
+ * Base class for compiled logic etc. The compiler creates derived classes. An
+ * instance of the derived class will be created whenever
+ *
+ * @author Daniel Grunwald
+ */
+public abstract class MedicalLogicModuleImplementation {
+ public MedicalLogicModuleImplementation(ExecutionContext context) {
+ // All derived classes are expected to have a constructor taking a
+ // context,
+ // which should call this constructor.
+ if (context == null)
+ throw new IllegalArgumentException();
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.