diff --git a/core/org.eclipse.cdt.core.linux.aarch64/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.linux.aarch64/META-INF/MANIFEST.MF
index e1ad5ed5569..0a7de03a046 100644
--- a/core/org.eclipse.cdt.core.linux.aarch64/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.linux.aarch64/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.linux.aarch64
Bundle-SymbolicName: org.eclipse.cdt.core.linux.aarch64;singleton:=true
-Bundle-Version: 6.0.0.qualifier
+Bundle-Version: 6.0.100.qualifier
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Localization: plugin
diff --git a/core/org.eclipse.cdt.core.linux.aarch64/os/linux/aarch64/libspawner.so b/core/org.eclipse.cdt.core.linux.aarch64/os/linux/aarch64/libspawner.so
index f0d076d9ff6..b6289ee9edc 100755
Binary files a/core/org.eclipse.cdt.core.linux.aarch64/os/linux/aarch64/libspawner.so and b/core/org.eclipse.cdt.core.linux.aarch64/os/linux/aarch64/libspawner.so differ
diff --git a/core/org.eclipse.cdt.core.linux.aarch64/pom.xml b/core/org.eclipse.cdt.core.linux.aarch64/pom.xml
index ee93a7ad2ff..84671b017aa 100644
--- a/core/org.eclipse.cdt.core.linux.aarch64/pom.xml
+++ b/core/org.eclipse.cdt.core.linux.aarch64/pom.xml
@@ -11,7 +11,7 @@
../../pom.xml
- 6.0.0-SNAPSHOT
+ 6.0.100-SNAPSHOT
org.eclipse.cdt.core.linux.aarch64
eclipse-plugin
diff --git a/core/org.eclipse.cdt.core.linux.ppc64le/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.linux.ppc64le/META-INF/MANIFEST.MF
index 7586bdce61d..ae80f5f3d00 100644
--- a/core/org.eclipse.cdt.core.linux.ppc64le/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.linux.ppc64le/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-SymbolicName: org.eclipse.cdt.core.linux.ppc64le;singleton:=true
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-Name: %fragmentName.linux.ppc64le
-Bundle-Version: 6.0.0.qualifier
+Bundle-Version: 6.0.100.qualifier
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Vendor: %providerName
Eclipse-PlatformFilter: (&(osgi.os=linux)(osgi.arch=ppc64le))
diff --git a/core/org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64le/libspawner.so b/core/org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64le/libspawner.so
index 268007b7d8d..25ae3f2e5bc 100755
Binary files a/core/org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64le/libspawner.so and b/core/org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64le/libspawner.so differ
diff --git a/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml b/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml
index 9d0d795697c..a8c20c11f23 100644
--- a/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml
+++ b/core/org.eclipse.cdt.core.linux.ppc64le/pom.xml
@@ -11,7 +11,7 @@
../../pom.xml
- 6.0.0-SNAPSHOT
+ 6.0.100-SNAPSHOT
org.eclipse.cdt.core.linux.ppc64le
eclipse-plugin
diff --git a/core/org.eclipse.cdt.core.linux.x86_64/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.linux.x86_64/META-INF/MANIFEST.MF
index 14eabee4ac0..2a9b6739dd4 100644
--- a/core/org.eclipse.cdt.core.linux.x86_64/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.linux.x86_64/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.linux.x86_64
Bundle-SymbolicName: org.eclipse.cdt.core.linux.x86_64;singleton:=true
-Bundle-Version: 6.0.0.qualifier
+Bundle-Version: 6.0.100.qualifier
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Localization: plugin
diff --git a/core/org.eclipse.cdt.core.linux.x86_64/os/linux/x86_64/libspawner.so b/core/org.eclipse.cdt.core.linux.x86_64/os/linux/x86_64/libspawner.so
index dddd4fbc72c..2a9b19f08a9 100755
Binary files a/core/org.eclipse.cdt.core.linux.x86_64/os/linux/x86_64/libspawner.so and b/core/org.eclipse.cdt.core.linux.x86_64/os/linux/x86_64/libspawner.so differ
diff --git a/core/org.eclipse.cdt.core.linux.x86_64/pom.xml b/core/org.eclipse.cdt.core.linux.x86_64/pom.xml
index 3127254a517..33a9af49a55 100644
--- a/core/org.eclipse.cdt.core.linux.x86_64/pom.xml
+++ b/core/org.eclipse.cdt.core.linux.x86_64/pom.xml
@@ -11,7 +11,7 @@
../../pom.xml
- 6.0.0-SNAPSHOT
+ 6.0.100-SNAPSHOT
org.eclipse.cdt.core.linux.x86_64
eclipse-plugin
diff --git a/core/org.eclipse.cdt.core.macosx/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.macosx/META-INF/MANIFEST.MF
index fe57d4956ea..d1352062481 100644
--- a/core/org.eclipse.cdt.core.macosx/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.macosx/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.macosx
Bundle-SymbolicName: org.eclipse.cdt.core.macosx; singleton:=true
-Bundle-Version: 6.0.0.qualifier
+Bundle-Version: 6.0.100.qualifier
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Localization: plugin
diff --git a/core/org.eclipse.cdt.core.macosx/os/macosx/x86/libspawner.jnilib b/core/org.eclipse.cdt.core.macosx/os/macosx/x86/libspawner.jnilib
index 99547975b6c..cd5afe34824 100755
Binary files a/core/org.eclipse.cdt.core.macosx/os/macosx/x86/libspawner.jnilib and b/core/org.eclipse.cdt.core.macosx/os/macosx/x86/libspawner.jnilib differ
diff --git a/core/org.eclipse.cdt.core.macosx/os/macosx/x86_64/libspawner.jnilib b/core/org.eclipse.cdt.core.macosx/os/macosx/x86_64/libspawner.jnilib
index 73c5622ac60..3942e467255 100755
Binary files a/core/org.eclipse.cdt.core.macosx/os/macosx/x86_64/libspawner.jnilib and b/core/org.eclipse.cdt.core.macosx/os/macosx/x86_64/libspawner.jnilib differ
diff --git a/core/org.eclipse.cdt.core.macosx/pom.xml b/core/org.eclipse.cdt.core.macosx/pom.xml
index b82bebf1596..439e7ea6da5 100644
--- a/core/org.eclipse.cdt.core.macosx/pom.xml
+++ b/core/org.eclipse.cdt.core.macosx/pom.xml
@@ -11,7 +11,7 @@
../../pom.xml
- 6.0.0-SNAPSHOT
+ 6.0.100-SNAPSHOT
org.eclipse.cdt.core.macosx
eclipse-plugin
diff --git a/core/org.eclipse.cdt.core.native/.project b/core/org.eclipse.cdt.core.native/.project
index 16748cc2a7f..7b153603502 100644
--- a/core/org.eclipse.cdt.core.native/.project
+++ b/core/org.eclipse.cdt.core.native/.project
@@ -30,5 +30,6 @@
org.eclipse.jdt.core.javanature
org.eclipse.pde.PluginNature
org.eclipse.pde.api.tools.apiAnalysisNature
+ org.eclipse.cdt.core.cnature
diff --git a/core/org.eclipse.cdt.core.native/.settings/org.eclipse.cdt.core.prefs b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 00000000000..85b6db296e7
--- /dev/null
+++ b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,189 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.cdt.core.formatter.alignment_for_assignment=16
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
+org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
+org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
+org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
+org.eclipse.cdt.core.formatter.alignment_for_member_access=0
+org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
+org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
+org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
+org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
+org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
+org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
+org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
+org.eclipse.cdt.core.formatter.compact_else_if=true
+org.eclipse.cdt.core.formatter.continuation_indentation=2
+org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.cdt.core.formatter.format_block_comment=true
+org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.cdt.core.formatter.format_header_comment=true
+org.eclipse.cdt.core.formatter.format_line_comment=true
+org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
+org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
+org.eclipse.cdt.core.formatter.indent_empty_lines=false
+org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.cdt.core.formatter.indentation.size=4
+org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.join_wrapped_lines=true
+org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.lineSplit=120
+org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.cdt.core.formatter.tabulation.char=tab
+org.eclipse.cdt.core.formatter.tabulation.size=4
+org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
+org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/core/org.eclipse.cdt.core.native/.settings/org.eclipse.cdt.ui.prefs b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.cdt.ui.prefs
new file mode 100644
index 00000000000..4f7bce2bbb8
--- /dev/null
+++ b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.cdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_Unmanaged profile 'CDT'
+formatter_settings_version=1
diff --git a/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF
index 25673505d5e..07649b97f34 100644
--- a/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.native/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core.native;singleton:=true
-Bundle-Version: 6.0.0.qualifier
+Bundle-Version: 6.0.100.qualifier
Bundle-Activator: org.eclipse.cdt.internal.core.natives.CNativePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/exec0.h b/core/org.eclipse.cdt.core.native/native_src/unix/exec0.h
index 04f363d5e53..ab5648482c6 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/exec0.h
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/exec0.h
@@ -19,14 +19,9 @@
#include
#include
-extern pid_t exec0(const char *path, char *const argv[],
- char *const envp[], const char *dirpath,
- int channels[3]);
+extern pid_t exec0(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3]);
-
-extern pid_t exec_pty(const char *path, char *const argv[],
- char *const envp[], const char *dirpath,
- int channels[3], const char *pts_name, int fdm,
- int console);
+extern pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3],
+ const char *pts_name, int fdm, int console);
extern int wait0(pid_t pid);
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c b/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c
index e020053db41..0aac5f689ee 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/exec_pty.c
@@ -26,12 +26,10 @@
#include
/* from pfind.c */
-extern char *pfind(const char *name, char * const envp[]);
+extern char* pfind(const char *name, char *const envp[]);
-pid_t
-exec_pty(const char *path, char *const argv[], char *const envp[],
- const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
-{
+pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3],
+ const char *pts_name, int fdm, int console) {
int pipe2[2];
pid_t childpid;
char *full_path;
@@ -39,7 +37,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
/*
* We use pfind() to check that the program exists and is an executable.
* If not pass the error up. Also execve() wants a full path.
- */
+ */
full_path = pfind(path, envp);
if (full_path == NULL) {
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
@@ -48,9 +46,9 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
/*
* Make sure we can create our pipes before forking.
- */
+ */
if (channels != NULL && console) {
- if (pipe(pipe2) < 0) {
+ if (pipe(pipe2) < 0) {
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
free(full_path);
return -1;
@@ -60,7 +58,8 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
childpid = fork();
if (childpid < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__,
+ __LINE__, strerror(errno));
free(full_path);
return -1;
} else if (childpid == 0) { /* child */
@@ -98,14 +97,14 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
}
/* redirections */
- dup2(fds, STDIN_FILENO); /* dup stdin */
- dup2(fds, STDOUT_FILENO); /* dup stdout */
+ dup2(fds, STDIN_FILENO); /* dup stdin */
+ dup2(fds, STDOUT_FILENO); /* dup stdout */
if (console) {
- dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
+ dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
} else {
- dup2(fds, STDERR_FILENO); /* dup stderr */
+ dup2(fds, STDERR_FILENO); /* dup stderr */
}
- close(fds); /* done with fds. */
+ close(fds); /* done with fds. */
}
/* Close all the fd's in the child */
@@ -147,7 +146,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
}
free(full_path);
- return -1; /*NOT REACHED */
+ return -1; /*NOT REACHED */
}
#ifdef __STAND_ALONE__
int main(int argc, char **argv, char **envp) {
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/exec_unix.c b/core/org.eclipse.cdt.core.native/native_src/unix/exec_unix.c
index 4feb805f15d..abaa5caab89 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/exec_unix.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/exec_unix.c
@@ -23,12 +23,9 @@
#include
/* from pfind.c */
-extern char *pfind(const char *name, char * const envp[]);
+extern char* pfind(const char *name, char *const envp[]);
-pid_t
-exec0(const char *path, char *const argv[], char *const envp[],
- const char *dirpath, int channels[3])
-{
+pid_t exec0(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3]) {
int pipe0[2], pipe1[2], pipe2[2];
pid_t childpid;
char *full_path;
@@ -36,7 +33,7 @@ exec0(const char *path, char *const argv[], char *const envp[],
/*
* We use pfind() to check that the program exists and is an executable.
* If not pass the error up. Also execve() wants a full path.
- */
+ */
full_path = pfind(path, envp);
if (full_path == NULL) {
fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
@@ -45,11 +42,11 @@ exec0(const char *path, char *const argv[], char *const envp[],
/*
* Make sure we can create our pipes before forking.
- */
+ */
if (channels != NULL) {
if (pipe(pipe0) < 0 || pipe(pipe1) < 0 || pipe(pipe2) < 0) {
- fprintf(stderr, "%s(%d): returning due to error.\n",
- __FUNCTION__, __LINE__);
+ fprintf(stderr, "%s(%d): returning due to error.\n", __FUNCTION__,
+ __LINE__);
free(full_path);
return -1;
}
@@ -58,8 +55,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
childpid = fork();
if (childpid < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n",
- __FUNCTION__, __LINE__, strerror(errno));
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__,
+ __LINE__, strerror(errno));
free(full_path);
return -1;
} else if (childpid == 0) { /* child */
@@ -81,9 +78,9 @@ exec0(const char *path, char *const argv[], char *const envp[],
perror("close(pipe2[0]))");
/* redirections */
- dup2(pipe0[0], STDIN_FILENO); /* dup stdin */
- dup2(pipe1[1], STDOUT_FILENO); /* dup stdout */
- dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
+ dup2(pipe0[0], STDIN_FILENO); /* dup stdin */
+ dup2(pipe1[1], STDOUT_FILENO); /* dup stdout */
+ dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
}
/* Close all the fd's in the child */
@@ -113,13 +110,13 @@ exec0(const char *path, char *const argv[], char *const envp[],
/* close the read end of pipe1 */
if (close(pipe0[0]) == -1)
perror("close(pipe0[0])");
-
+
/* close the write end of pipe2 */
- if (close(pipe1[1]) == -1)
+ if (close(pipe1[1]) == -1)
perror("close(pipe1[1])");
/* close the write end of pipe2 */
- if (close(pipe2[1]) == -1)
+ if (close(pipe2[1]) == -1)
perror("close(pipe2[1])");
channels[0] = pipe0[1]; /* Output Stream. */
@@ -132,18 +129,16 @@ exec0(const char *path, char *const argv[], char *const envp[],
}
free(full_path);
- return -1; /*NOT REACHED */
+ return -1; /*NOT REACHED */
}
-
-int wait0(pid_t pid)
-{
+int wait0(pid_t pid) {
int status;
int val = -1;
if (pid < 0)
return -1;
-
+
for (;;) {
if (waitpid(pid, &status, 0) < 0) {
if (errno == EINTR) {
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/io.c b/core/org.eclipse.cdt.core.native/native_src/unix/io.c
index 5ee22f8cf06..af3bcd626cd 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/io.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/io.c
@@ -21,113 +21,95 @@
/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerInputStream */
/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerOutputStream */
-static void ThrowByName(JNIEnv *env, const char *name, const char *msg)
-{
- jclass cls = (*env)->FindClass(env, name);
+static void ThrowByName(JNIEnv *env, const char *name, const char *msg) {
+ jclass cls = (*env)->FindClass(env, name);
- if (cls != 0) /* Otherwise an exception has already been thrown */
- (*env)->ThrowNew(env, cls, msg);
+ if (cls != 0) /* Otherwise an exception has already been thrown */
+ (*env)->ThrowNew(env, cls, msg);
- /* It's a good practice to clean up the local references. */
- (*env)->DeleteLocalRef(env, cls);
+ /* It's a good practice to clean up the local references. */
+ (*env)->DeleteLocalRef(env, cls);
}
-static int channelToFileDesc(JNIEnv * env, jobject channel)
-{
- if (channel == 0) {
- ThrowByName(env, "java/io/IOException", "Invalid channel object");
- return -1;
- }
+static int channelToFileDesc(JNIEnv *env, jobject channel) {
+ if (channel == 0) {
+ ThrowByName(env, "java/io/IOException", "Invalid channel object");
+ return -1;
+ }
- jclass cls = (*env)->GetObjectClass(env, channel);
- if (cls == 0) {
- ThrowByName(env, "java/io/IOException", "Unable to get channel class");
- return -1;
- }
+ jclass cls = (*env)->GetObjectClass(env, channel);
+ if (cls == 0) {
+ ThrowByName(env, "java/io/IOException", "Unable to get channel class");
+ return -1;
+ }
- jfieldID fid = (*env)->GetFieldID(env, cls, "fd", "I");
- if (fid == 0) {
- ThrowByName(env, "java/io/IOException", "Unable to find fd");
- return -1;
- }
+ jfieldID fid = (*env)->GetFieldID(env, cls, "fd", "I");
+ if (fid == 0) {
+ ThrowByName(env, "java/io/IOException", "Unable to find fd");
+ return -1;
+ }
- jint fd = (*env)->GetIntField(env, channel, fid);
- return fd;
+ jint fd = (*env)->GetIntField(env, channel, fid);
+ return fd;
}
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv * env,
- jobject jobj,
- jobject channel,
- jbyteArray buf,
- jint buf_len)
-{
- int fd;
- int status;
- jbyte *data;
- int data_len;
+Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv *env, jobject jobj, jobject channel, jbyteArray buf,
+ jint buf_len) {
+ int fd;
+ int status;
+ jbyte *data;
+ int data_len;
- data = (*env)->GetByteArrayElements(env, buf, 0);
- data_len = buf_len;
- fd = channelToFileDesc(env, channel);
+ data = (*env)->GetByteArrayElements(env, buf, 0);
+ data_len = buf_len;
+ fd = channelToFileDesc(env, channel);
- status = read( fd, data, data_len );
- (*env)->ReleaseByteArrayElements(env, buf, data, 0);
+ status = read(fd, data, data_len);
+ (*env)->ReleaseByteArrayElements(env, buf, data, 0);
- if (status == 0) {
- /* EOF. */
- status = -1;
- } else if (status == -1) {
- /* Error, toss an exception */
- jclass exception = (*env)->FindClass(env, "java/io/IOException");
- if (exception == NULL) {
- /* Give up. */
- return -1;
- }
- (*env)->ThrowNew(env, exception, "read error");
- }
+ if (status == 0) {
+ /* EOF. */
+ status = -1;
+ } else if (status == -1) {
+ /* Error, toss an exception */
+ jclass exception = (*env)->FindClass(env, "java/io/IOException");
+ if (exception == NULL) {
+ /* Give up. */
+ return -1;
+ }
+ (*env)->ThrowNew(env, exception, "read error");
+ }
- return status;
-}
-
-
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv * env,
- jobject jobj,
- jobject channel)
-{
- int fd = channelToFileDesc(env, channel);
- return close(fd);
+ return status;
}
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv * env,
- jobject jobj,
- jobject channel,
- jbyteArray buf,
- jint buf_len)
-{
- int status;
- int fd;
- jbyte *data;
- int data_len;
-
- data = (*env)->GetByteArrayElements(env, buf, 0);
- data_len = buf_len;
- fd = channelToFileDesc(env, channel);
-
- status = write(fd, data, data_len);
- (*env)->ReleaseByteArrayElements(env, buf, data, 0);
-
- return status;
+Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv *env, jobject jobj, jobject channel) {
+ int fd = channelToFileDesc(env, channel);
+ return close(fd);
}
-
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv * env,
- jobject jobj,
- jobject channel)
-{
- int fd = channelToFileDesc(env, channel);
- return close(fd);
+Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv *env, jobject jobj, jobject channel,
+ jbyteArray buf, jint buf_len) {
+ int status;
+ int fd;
+ jbyte *data;
+ int data_len;
+
+ data = (*env)->GetByteArrayElements(env, buf, 0);
+ data_len = buf_len;
+ fd = channelToFileDesc(env, channel);
+
+ status = write(fd, data, data_len);
+ (*env)->ReleaseByteArrayElements(env, buf, data, 0);
+
+ return status;
+}
+
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv *env, jobject jobj, jobject channel) {
+ int fd = channelToFileDesc(env, channel);
+ return close(fd);
}
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/openpty.c b/core/org.eclipse.cdt.core.native/native_src/unix/openpty.c
index 2ca02e2278c..52d84f91ed2 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/openpty.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/openpty.c
@@ -35,15 +35,13 @@
* Alain Magloire.
*/
-int ptym_open (char *pts_name);
-int ptys_open (int fdm, const char * pts_name);
+int ptym_open(char *pts_name);
+int ptys_open(int fdm, const char *pts_name);
void set_noecho(int fd);
-int
-openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp)
-{
+int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) {
char line[20];
- line[0]=0;
+ line[0] = 0;
*amaster = ptym_open(line);
if (*amaster < 0)
return -1;
@@ -67,12 +65,10 @@ openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct win
return 0;
}
-void
-set_noecho(int fd)
-{
+void set_noecho(int fd) {
struct termios stermios;
if (tcgetattr(fd, &stermios) < 0) {
- return ;
+ return;
}
/* turn off echo */
@@ -85,9 +81,7 @@ set_noecho(int fd)
tcsetattr(fd, TCSANOW, &stermios);
}
-int
-ptym_open(char * pts_name)
-{
+int ptym_open(char *pts_name) {
int fdm;
char *ptr;
@@ -109,16 +103,14 @@ ptym_open(char * pts_name)
}
ptr = ptsname(fdm);
if (ptr == NULL) { /* get slave's name */
- close (fdm);
+ close(fdm);
return -4;
}
strcpy(pts_name, ptr); /* return name of slave */
- return fdm; /* return fd of master */
+ return fdm; /* return fd of master */
}
-int
-ptys_open(int fdm, const char * pts_name)
-{
+int ptys_open(int fdm, const char *pts_name) {
int fds;
/* following should allocate controlling terminal */
fds = open(pts_name, O_RDWR);
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/openpty.h b/core/org.eclipse.cdt.core.native/native_src/unix/openpty.h
index 234a306415d..036233db08e 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/openpty.h
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/openpty.h
@@ -15,7 +15,7 @@
*******************************************************************************/
#ifndef _OPENPTY_H
#define _OPENPTY_H
-int ptym_open (char *pts_name);
-int ptys_open (int fdm, const char * pts_name);
+int ptym_open(char *pts_name);
+int ptys_open(int fdm, const char *pts_name);
void set_noecho(int fd);
#endif
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/pfind.c b/core/org.eclipse.cdt.core.native/native_src/unix/pfind.c
index ce7a752715c..851e5f1c4aa 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/pfind.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/pfind.c
@@ -32,28 +32,26 @@
#define PATH_DEF "PATH="
const int path_def_len = 5; /* strlen(PATH_DEF); */
-char * path_val(char * const envp[])
-{
+char* path_val(char *const envp[]) {
int i;
if (envp == NULL || envp[0] == NULL)
- return getenv("PATH" );
-
- for(i = 0; envp[i] != NULL; i++){
- char* p = envp[i];
- if(!strncmp(PATH_DEF, p, path_def_len)){
+ return getenv("PATH");
+
+ for (i = 0; envp[i] != NULL; i++) {
+ char *p = envp[i];
+ if (!strncmp(PATH_DEF, p, path_def_len)) {
return p + path_def_len;
}
}
-
+
return NULL;
}
-char * pfind(const char *name, char * const envp[])
-{
+char* pfind(const char *name, char *const envp[]) {
char *tok;
char *sp;
char *path;
- char fullpath[PATH_MAX+1];
+ char fullpath[PATH_MAX + 1];
struct stat sb;
/* Sanity check. */
@@ -71,7 +69,7 @@ char * pfind(const char *name, char * const envp[])
}
/* Search in the PATH environment. */
- path = path_val( envp );
+ path = path_val(envp);
if (path == NULL || strlen(path) <= 0) {
fprintf(stderr, "Unable to get $PATH.\n");
@@ -92,7 +90,7 @@ char * pfind(const char *name, char * const envp[])
}
}
- tok = strtok_r( NULL, ":", &sp );
+ tok = strtok_r(NULL, ":", &sp);
}
free(path);
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/pty.c b/core/org.eclipse.cdt.core.native/native_src/unix/pty.c
index 096815a71ca..14f3703832a 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/pty.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/pty.c
@@ -22,11 +22,11 @@
* Signature: ()I
*/
JNIEXPORT jstring JNICALL
-Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj, jboolean console) {
+Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *env, jobject jobj, jboolean console) {
jfieldID fid; /* Store the field ID */
jstring jstr = NULL;
int master = -1;
- char line[1024]; /* FIXME: Should be enough */
+ char line[1024]; /* FIXME: Should be enough */
jclass cls;
line[0] = '\0';
@@ -46,7 +46,7 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj, jboole
if (fid == NULL) {
return NULL;
}
- (*env)->SetIntField(env, jobj, fid, (jint)master);
+ (*env)->SetIntField(env, jobj, fid, (jint) master);
/* Create a new String for the slave. */
jstr = (*env)->NewStringUTF(env, line);
@@ -54,9 +54,8 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj, jboole
return jstr;
}
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
- (JNIEnv *env, jobject jobj, jint fdm, jint width, jint height)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(JNIEnv *env, jobject jobj, jint fdm,
+ jint width, jint height) {
#ifdef TIOCSWINSZ
struct winsize win;
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c b/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c
index 98ab38eb43a..cf8dec9d173 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/ptyio.c
@@ -26,31 +26,26 @@
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv * env,
- jobject jobj,
- jint jfd,
- jbyteArray buf,
- jint buf_len)
-{
- int fd;
- int status;
- jbyte *data;
- int data_len;
+Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv *env, jobject jobj, jint jfd, jbyteArray buf, jint buf_len) {
+ int fd;
+ int status;
+ jbyte *data;
+ int data_len;
- data = (*env)->GetByteArrayElements(env, buf, 0);
- data_len = buf_len;
- fd = jfd;
+ data = (*env)->GetByteArrayElements(env, buf, 0);
+ data_len = buf_len;
+ fd = jfd;
- status = read( fd, data, data_len );
- (*env)->ReleaseByteArrayElements(env, buf, data, 0);
+ status = read(fd, data, data_len);
+ (*env)->ReleaseByteArrayElements(env, buf, data, 0);
- if (status == 0) {
- /* EOF. */
- status = -1;
- } else if (status == -1) {
- /* Error, toss an exception */
- /* Ignore the error for now, the debugger will attempt
- * to close this multiple time. */
+ if (status == 0) {
+ /* EOF. */
+ status = -1;
+ } else if (status == -1) {
+ /* Error, toss an exception */
+ /* Ignore the error for now, the debugger will attempt
+ * to close this multiple time. */
#if 0
jclass exception = (*env)->FindClass(env, "java/io/IOException");
if (exception == NULL) {
@@ -59,23 +54,19 @@ Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv * env,
}
(*env)->ThrowNew(env, exception, "read error");
#endif
- }
+ }
- return status;
+ return status;
}
-
/*
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv * env,
- jobject jobj,
- jint fd)
-{
- return close(fd);
+Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
+ return close(fd);
}
/*
@@ -84,37 +75,28 @@ Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv * env,
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv * env,
- jobject jobj,
- jint jfd,
- jbyteArray buf,
- jint buf_len)
-{
- int status;
- int fd;
- jbyte *data;
- int data_len;
+Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv *env, jobject jobj, jint jfd, jbyteArray buf, jint buf_len) {
+ int status;
+ int fd;
+ jbyte *data;
+ int data_len;
- data = (*env)->GetByteArrayElements(env, buf, 0);
- data_len = buf_len;
- fd = jfd;
+ data = (*env)->GetByteArrayElements(env, buf, 0);
+ data_len = buf_len;
+ fd = jfd;
- status = write(fd, data, data_len);
- (*env)->ReleaseByteArrayElements(env, buf, data, 0);
+ status = write(fd, data, data_len);
+ (*env)->ReleaseByteArrayElements(env, buf, data, 0);
- return status;
+ return status;
}
-
/*
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv * env,
- jobject jobj,
- jint fd)
-{
- return close(fd);
+Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
+ return close(fd);
}
diff --git a/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c b/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c
index f9b91534c75..44369defb54 100644
--- a/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c
+++ b/core/org.eclipse.cdt.core.native/native_src/unix/spawner.c
@@ -23,15 +23,12 @@
#include "exec0.h"
#include
-
#define DEBUGIT 0
-
/*
* Header for class org_eclipse_cdt_utils_spawner_Spawner
*/
-
#if DEBUGIT
static void print_array(char **c_array)
{
@@ -49,64 +46,56 @@ static void print_array(char **c_array)
}
#endif
+static char** alloc_c_array(JNIEnv *env, jobjectArray j_array) {
+ int i;
+ jint c_array_size = (*env)->GetArrayLength(env, j_array);
+ char **c_array = calloc(c_array_size + 1, sizeof(*c_array));
-static char **alloc_c_array(JNIEnv * env, jobjectArray j_array)
-{
- int i;
- jint c_array_size = (*env)->GetArrayLength(env, j_array);
- char **c_array = calloc(c_array_size + 1, sizeof(*c_array));
+ if (c_array == NULL)
+ return NULL;
- if (c_array == NULL)
- return NULL;
+ for (i = 0; i < c_array_size; i++) {
+ jstring j_str = (jstring)(*env)->GetObjectArrayElement(env, j_array, i);
+ const char *c_str = (*env)->GetStringUTFChars(env, j_str, NULL);
+ c_array[i] = (char*) strdup(c_str);
+ (*env)->ReleaseStringUTFChars(env, j_str, c_str);
+ (*env)->DeleteLocalRef(env, j_str);
+ }
- for (i = 0; i < c_array_size; i++) {
- jstring j_str =
- (jstring) (*env)->GetObjectArrayElement(env, j_array, i);
- const char *c_str = (*env)->GetStringUTFChars(env, j_str, NULL);
- c_array[i] = (char *) strdup(c_str);
- (*env)->ReleaseStringUTFChars(env, j_str, c_str);
- (*env)->DeleteLocalRef(env, j_str);
- }
-
- return c_array;
+ return c_array;
}
-
-static void free_c_array(char **c_array)
-{
- if (c_array) {
- char **p = c_array;
- for (; *p; p++) {
- if (*p) {
- free(*p);
- }
- }
- free(c_array);
- }
+static void free_c_array(char **c_array) {
+ if (c_array) {
+ char **p = c_array;
+ for (; *p; p++) {
+ if (*p) {
+ free(*p);
+ }
+ }
+ free(c_array);
+ }
}
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2(JNIEnv *env, jobject jobj, jobjectArray jcmd,
+ jobjectArray jenv, jstring jdir, jobjectArray jchannels, jstring jslaveName, jint masterFD, jboolean console) {
+ const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
+ const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
+ char **cmd = NULL;
+ char **envp = NULL;
+ int fd[3];
+ pid_t pid = -1;
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
- (JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jobjectArray jchannels,
- jstring jslaveName, jint masterFD, jboolean console)
-{
- const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
- const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
- char **cmd = NULL;
- char **envp = NULL;
- int fd[3];
- pid_t pid = -1;
+ if (jchannels == NULL)
+ goto bail_out;
- if (jchannels == NULL)
- goto bail_out;
+ cmd = alloc_c_array(env, jcmd);
+ if (cmd == NULL)
+ goto bail_out;
- cmd = alloc_c_array(env, jcmd);
- if (cmd == NULL)
- goto bail_out;
-
- envp = alloc_c_array(env, jenv);
- if (envp == NULL)
- goto bail_out;
+ envp = alloc_c_array(env, jenv);
+ if (envp == NULL)
+ goto bail_out;
#if DEBUGIT
fprintf(stderr, "command:");
@@ -117,47 +106,41 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
fprintf(stderr, "pts_name: %s\n", pts_name);
#endif
- pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD, console);
- if (pid < 0)
- goto bail_out;
+ pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD, console);
+ if (pid < 0)
+ goto bail_out;
- jobject cls = (*env)->FindClass(env, "org/eclipse/cdt/utils/spawner/Spawner$UnixChannel");
- jmethodID constructor = (*env)->GetMethodID(env, cls, "", "(I)V");
- for (jsize i = 0; i < 3; i++) {
- jobject chan = (*env)->NewObject(env, cls, constructor, fd[i]);
- (*env)->SetObjectArrayElement(env, jchannels, i, chan);
- }
+ jobject cls = (*env)->FindClass(env, "org/eclipse/cdt/utils/spawner/Spawner$UnixChannel");
+ jmethodID constructor = (*env)->GetMethodID(env, cls, "", "(I)V");
+ for (jsize i = 0; i < 3; i++) {
+ jobject chan = (*env)->NewObject(env, cls, constructor, fd[i]);
+ (*env)->SetObjectArrayElement(env, jchannels, i, chan);
+ }
-
- bail_out:
- (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
- (*env)->ReleaseStringUTFChars(env, jslaveName, pts_name);
- if (cmd)
- free_c_array(cmd);
- if (envp)
- free_c_array(envp);
- return pid;
+ bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
+ (*env)->ReleaseStringUTFChars(env, jslaveName, pts_name);
+ if (cmd)
+ free_c_array(cmd);
+ if (envp)
+ free_c_array(envp);
+ return pid;
}
-
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
- jobjectArray jcmd,
- jobjectArray jenv,
- jstring jdir)
-{
- const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
- char **cmd = NULL;
- char **envp = NULL;
- pid_t pid = -1;
+Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv,
+ jstring jdir) {
+ const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
+ char **cmd = NULL;
+ char **envp = NULL;
+ pid_t pid = -1;
- cmd = alloc_c_array(env, jcmd);
- if (cmd == NULL)
- goto bail_out;
+ cmd = alloc_c_array(env, jcmd);
+ if (cmd == NULL)
+ goto bail_out;
- envp = alloc_c_array(env, jenv);
- if (envp == NULL)
- goto bail_out;
+ envp = alloc_c_array(env, jenv);
+ if (envp == NULL)
+ goto bail_out;
#if DEBUGIT
fprintf(stderr, "command:");
@@ -167,52 +150,47 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
fprintf(stderr, "dirpath: %s\n", dirpath);
#endif
- pid = exec0(cmd[0], cmd, envp, dirpath, NULL);
- if (pid < 0)
- goto bail_out;
+ pid = exec0(cmd[0], cmd, envp, dirpath, NULL);
+ if (pid < 0)
+ goto bail_out;
- bail_out:
- (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
- if (cmd)
- free_c_array(cmd);
- if (envp)
- free_c_array(envp);
- return pid;
+ bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
+ if (cmd)
+ free_c_array(cmd);
+ if (envp)
+ free_c_array(envp);
+ return pid;
}
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
- jobjectArray jcmd,
- jobjectArray jenv,
- jstring jdir,
- jobjectArray jchannels)
-{
- const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
- char **cmd = NULL;
- char **envp = NULL;
- int fd[3];
- pid_t pid = -1;
- jclass channelClass = NULL;
- jmethodID channelConstructor = NULL;
+Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv,
+ jstring jdir, jobjectArray jchannels) {
+ const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
+ char **cmd = NULL;
+ char **envp = NULL;
+ int fd[3];
+ pid_t pid = -1;
+ jclass channelClass = NULL;
+ jmethodID channelConstructor = NULL;
- if (jchannels == NULL)
- goto bail_out;
+ if (jchannels == NULL)
+ goto bail_out;
- channelClass = (*env)->FindClass(env, "org/eclipse/cdt/utils/spawner/Spawner$UnixChannel");
- if (channelClass == 0)
- goto bail_out;
+ channelClass = (*env)->FindClass(env, "org/eclipse/cdt/utils/spawner/Spawner$UnixChannel");
+ if (channelClass == 0)
+ goto bail_out;
- channelConstructor = (*env)->GetMethodID(env, channelClass, "", "(I)V");
- if (channelConstructor == 0)
- goto bail_out;
+ channelConstructor = (*env)->GetMethodID(env, channelClass, "", "(I)V");
+ if (channelConstructor == 0)
+ goto bail_out;
- cmd = alloc_c_array(env, jcmd);
- if (cmd == NULL)
- goto bail_out;
+ cmd = alloc_c_array(env, jcmd);
+ if (cmd == NULL)
+ goto bail_out;
- envp = alloc_c_array(env, jenv);
- if (envp == NULL)
- goto bail_out;
+ envp = alloc_c_array(env, jenv);
+ if (envp == NULL)
+ goto bail_out;
#if DEBUGIT
fprintf(stderr, "command:");
@@ -221,22 +199,21 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
print_array(envp);
fprintf(stderr, "dirpath: %s\n", dirpath);
#endif
- pid = exec0(cmd[0], cmd, envp, dirpath, fd);
- if (pid < 0)
- goto bail_out;
+ pid = exec0(cmd[0], cmd, envp, dirpath, fd);
+ if (pid < 0)
+ goto bail_out;
- for (jsize i = 0; i < 3; i++) {
- jobject chan = (*env)->NewObject(env, channelClass, channelConstructor, fd[i]);
- (*env)->SetObjectArrayElement(env, jchannels, i, chan);
- }
+ for (jsize i = 0; i < 3; i++) {
+ jobject chan = (*env)->NewObject(env, channelClass, channelConstructor, fd[i]);
+ (*env)->SetObjectArrayElement(env, jchannels, i, chan);
+ }
- bail_out:
- (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
- if (cmd)
- free_c_array(cmd);
- if (envp)
- free_c_array(envp);
- return pid;
+ bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
+ if (cmd)
+ free_c_array(cmd);
+ if (envp)
+ free_c_array(envp);
+ return pid;
}
/*
@@ -245,61 +222,55 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * env, jobject jobj,
- jint pid, jint sig)
-{
- int status = -1;
+Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject jobj, jint pid, jint sig) {
+ int status = -1;
- switch (sig) {
- case 0: /* NOOP */
- status = killpg(pid, 0);
- if(status == -1) {
- status = kill(pid, 0);
- }
- break;
+ switch (sig) {
+ case 0: /* NOOP */
+ status = killpg(pid, 0);
+ if (status == -1) {
+ status = kill(pid, 0);
+ }
+ break;
- case 2: /* INTERRUPT */
- status = killpg(pid, SIGINT);
- if(status == -1) {
- status = kill(pid, SIGINT);
- }
- break;
+ case 2: /* INTERRUPT */
+ status = killpg(pid, SIGINT);
+ if (status == -1) {
+ status = kill(pid, SIGINT);
+ }
+ break;
- case 9: /* KILL */
- status = killpg(pid, SIGKILL);
- if(status == -1) {
- status = kill(pid, SIGKILL);
- }
- break;
+ case 9: /* KILL */
+ status = killpg(pid, SIGKILL);
+ if (status == -1) {
+ status = kill(pid, SIGKILL);
+ }
+ break;
- case 15: /* TERM */
- status = killpg(pid, SIGTERM);
- if(status == -1) {
- status = kill(pid, SIGTERM);
- }
- break;
+ case 15: /* TERM */
+ status = killpg(pid, SIGTERM);
+ if (status == -1) {
+ status = kill(pid, SIGTERM);
+ }
+ break;
- default:
- status = killpg(pid, sig); /* WHAT ?? */
- if(status == -1) {
- status = kill(pid, sig); /* WHAT ?? */
- }
- break;
- }
+ default:
+ status = killpg(pid, sig); /* WHAT ?? */
+ if (status == -1) {
+ status = kill(pid, sig); /* WHAT ?? */
+ }
+ break;
+ }
- return status;
+ return status;
}
-
-
/*
* Class: org_eclipse_cdt_utils_spawner_Spawner
* Method: waitFor
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv * env,
- jobject jobj, jint pid)
-{
- return wait0(pid);
+Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv *env, jobject jobj, jint pid) {
+ return wait0(pid);
}
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c b/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c
index 44209ee0e6f..66ec71b83c6 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c
+++ b/core/org.eclipse.cdt.core.native/native_src/win/Win32ProcessEx.c
@@ -16,7 +16,7 @@
*
* This is a JNI implementation of spawner
*******************************************************************************/
-
+
#include
#include
#include
@@ -34,63 +34,58 @@
#define MAX_PROCS (100) // Maximum number of simultaneously running processes
-
// Process description block. Should be created for each launched process
typedef struct _procInfo {
int pid; // Process ID
int uid; // quasi-unique process ID; we have to create it to avoid duplicated pid
- // (actually this impossible from OS point of view but it is still possible
+ // (actually this impossible from OS point of view but it is still possible
// a clash of new created and already finished process with one and the same PID.
// 4 events connected to this process (see starter)
- HANDLE eventBreak; // signaled when Spawner.interrupt() is called; mildest of the terminate requests (SIGINT signal in UNIX world)
+ HANDLE eventBreak;// signaled when Spawner.interrupt() is called; mildest of the terminate requests (SIGINT signal in UNIX world)
HANDLE eventWait;
- HANDLE eventTerminate; // signaled when Spawner.terminate() is called; more forceful terminate request (SIGTERM signal in UNIX world)
- HANDLE eventKill; // signaled when Spawner.kill() is called; most forceful terminate request (SIGKILL signal in UNIX world)
- HANDLE eventCtrlc; // signaled when Spawner.interruptCTRLC() is called; like interrupt() but sends CTRL-C in all cases, even when inferior is a Cygwin program
-} procInfo_t, * pProcInfo_t;
+ HANDLE eventTerminate;// signaled when Spawner.terminate() is called; more forceful terminate request (SIGTERM signal in UNIX world)
+ HANDLE eventKill;// signaled when Spawner.kill() is called; most forceful terminate request (SIGKILL signal in UNIX world)
+ HANDLE eventCtrlc;// signaled when Spawner.interruptCTRLC() is called; like interrupt() but sends CTRL-C in all cases, even when inferior is a Cygwin program
+} procInfo_t, *pProcInfo_t;
static int procCounter = 0; // Number of running processes
-
// This is a VM helper
void ThrowByName(JNIEnv *env, const char *name, const char *msg);
// Creates _procInfo block for every launched process
-pProcInfo_t createProcInfo();
+pProcInfo_t createProcInfo();
// Find process description for this pid
-pProcInfo_t findProcInfo(int pid);
+pProcInfo_t findProcInfo(int pid);
// We launch separate thread for each project to trap it termination
-void _cdecl waitProcTermination(void* pv) ;
+void _cdecl waitProcTermination(void* pv);
// This is a helper function to prevent losing of quotation marks
-static int copyTo(wchar_t * target, const wchar_t * source, int cpyLenght, int availSpace);
+static int copyTo(wchar_t *target, const wchar_t *source, int cpyLenght, int availSpace);
// Use this function to clean project descriptor and return it to the pool of available blocks.
static void cleanUpProcBlock(pProcInfo_t pCurProcInfo);
int interruptProcess(int pid);
-
// Signal codes
typedef enum {
- SIG_NOOP,
- SIG_HUP,
- SIG_INT,
- SIG_KILL = 9,
- SIG_TERM = 15,
+ SIG_NOOP, //
+ SIG_HUP, //
+ SIG_INT, //
+ SIG_KILL = 9, //
+ SIG_TERM = 15, //
CTRLC = 1000 // special, Windows only. Sends CTRL-C in all cases, even when inferior is a Cygwin program
} signals;
extern CRITICAL_SECTION cs;
-
extern wchar_t path[MAX_PATH]; // Directory where spawner.dll is located
static HMODULE hVM = NULL; // VM handler
-
static pProcInfo_t pInfo = NULL;
static int nCounter = 0; // We use it to build unique synchronization object names
@@ -107,47 +102,44 @@ static int nCounter = 0; // We use it to build unique synchronization object nam
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
- (JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir, jobjectArray channels, jstring slaveName, jint fdm, jboolean console)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2(JNIEnv *env, jobject process,
+ jobjectArray cmdarray, jobjectArray envp, jstring dir, jobjectArray channels, jstring slaveName, jint fdm,
+ jboolean console) {
return -1;
}
-void ensureSize(wchar_t** ptr, int* psize, int requiredLength)
-{
- int size= *psize;
- if (requiredLength > size) {
- size= 2*size;
- if (size < requiredLength) {
- size= requiredLength;
- }
- *ptr= (wchar_t *)realloc(*ptr, size * sizeof(wchar_t));
- if (NULL == *ptr) {
- *psize= 0;
- }
- else {
- *psize= size;
- }
- }
+void ensureSize(wchar_t **ptr, int *psize, int requiredLength) {
+ int size = *psize;
+ if (requiredLength > size) {
+ size = 2 * size;
+ if (size < requiredLength) {
+ size = requiredLength;
+ }
+ *ptr = (wchar_t*) realloc(*ptr, size * sizeof(wchar_t));
+ if (NULL == *ptr) {
+ *psize = 0;
+ } else {
+ *psize = size;
+ }
+ }
}
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
- (JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir, jobjectArray channels)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *env, jobject process,
+ jobjectArray cmdarray, jobjectArray envp, jstring dir, jobjectArray channels) {
HANDLE stdHandles[3];
- PROCESS_INFORMATION pi = {0}, *piCopy;
- STARTUPINFOW si;
+ PROCESS_INFORMATION pi = { 0 }, *piCopy;
+ STARTUPINFOW si;
DWORD flags = 0;
- const wchar_t * cwd = NULL;
+ const wchar_t *cwd = NULL;
LPVOID envBlk = NULL;
- int ret = 0;
- int nCmdLineLength= 0;
- wchar_t * szCmdLine= 0;
- int nBlkSize = MAX_ENV_SIZE;
- wchar_t * szEnvBlock = NULL;
+ int ret = 0;
+ int nCmdLineLength = 0;
+ wchar_t *szCmdLine = 0;
+ int nBlkSize = MAX_ENV_SIZE;
+ wchar_t *szEnvBlock = NULL;
jsize nCmdTokens = 0;
jsize nEnvVars = 0;
int i;
@@ -174,135 +166,131 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
jclass channelClass = NULL;
jmethodID channelConstructor = NULL;
- if (channels == NULL)
- {
+ if (channels == NULL) {
ThrowByName(env, "java/io/IOException", "Channels can't be null");
return 0;
- }
+ }
channelClass = (*env)->FindClass(env, "org/eclipse/cdt/utils/spawner/Spawner$WinChannel");
- if (channelClass == 0)
- {
+ if (channelClass == 0) {
ThrowByName(env, "java/io/IOException", "Unable to find channel class");
return 0;
- }
+ }
channelConstructor = (*env)->GetMethodID(env, channelClass, "", "(J)V");
- if (channelConstructor == 0)
- {
+ if (channelConstructor == 0) {
ThrowByName(env, "java/io/IOException", "Unable to find channel constructor");
return 0;
- }
+ }
- nCmdLineLength= MAX_CMD_SIZE;
- szCmdLine= (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
- szCmdLine[0]= _T('\0');
- if((HIBYTE(LOWORD(GetVersion()))) & 0x80)
- {
+ nCmdLineLength = MAX_CMD_SIZE;
+ szCmdLine = (wchar_t*) malloc(nCmdLineLength * sizeof(wchar_t));
+ szCmdLine[0] = _T('\0');
+ if ((HIBYTE(LOWORD(GetVersion()))) & 0x80) {
ThrowByName(env, "java/io/IOException", "Does not support Windows 3.1/95/98/Me");
return 0;
- }
+ }
- if (cmdarray == 0)
- {
+ if (cmdarray == 0) {
ThrowByName(env, "java/lang/NullPointerException", "No command line specified");
return 0;
- }
+ }
- ZeroMemory(stdHandles, sizeof(stdHandles));
+ ZeroMemory(stdHandles, sizeof(stdHandles));
// Create pipe names
- EnterCriticalSection(&cs);
- swprintf(inPipeName, sizeof(inPipeName)/sizeof(inPipeName[0]), L"\\\\.\\pipe\\stdin%08i%010i", pid, nCounter);
- swprintf(outPipeName, sizeof(outPipeName)/sizeof(outPipeName[0]), L"\\\\.\\pipe\\stdout%08i%010i", pid, nCounter);
- swprintf(errPipeName, sizeof(errPipeName)/sizeof(errPipeName[0]), L"\\\\.\\pipe\\stderr%08i%010i", pid, nCounter);
- nLocalCounter = nCounter;
- ++nCounter;
- LeaveCriticalSection(&cs);
+ EnterCriticalSection(&cs);
+ swprintf(inPipeName, sizeof(inPipeName) / sizeof(inPipeName[0]), L"\\\\.\\pipe\\stdin%08i%010i", pid, nCounter);
+ swprintf(outPipeName, sizeof(outPipeName) / sizeof(outPipeName[0]), L"\\\\.\\pipe\\stdout%08i%010i", pid, nCounter);
+ swprintf(errPipeName, sizeof(errPipeName) / sizeof(errPipeName[0]), L"\\\\.\\pipe\\stderr%08i%010i", pid, nCounter);
+ nLocalCounter = nCounter;
+ ++nCounter;
+ LeaveCriticalSection(&cs);
- if ((INVALID_HANDLE_VALUE == (stdHandles[0] = CreateNamedPipeW(inPipeName, PIPE_ACCESS_OUTBOUND,
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES, PIPE_SIZE, PIPE_SIZE, PIPE_TIMEOUT, NULL))) ||
- (INVALID_HANDLE_VALUE == (stdHandles[1] = CreateNamedPipeW(outPipeName, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES, PIPE_SIZE, PIPE_SIZE, PIPE_TIMEOUT, NULL))) ||
- (INVALID_HANDLE_VALUE == (stdHandles[2] = CreateNamedPipeW(errPipeName, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES, PIPE_SIZE, PIPE_SIZE, PIPE_TIMEOUT, NULL)))) {
+ if ((INVALID_HANDLE_VALUE
+ == (stdHandles[0] = CreateNamedPipeW(inPipeName, PIPE_ACCESS_OUTBOUND,
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, PIPE_SIZE, PIPE_SIZE,
+ PIPE_TIMEOUT, NULL)))
+ || (INVALID_HANDLE_VALUE
+ == (stdHandles[1] = CreateNamedPipeW(outPipeName, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, PIPE_SIZE,
+ PIPE_SIZE, PIPE_TIMEOUT, NULL)))
+ || (INVALID_HANDLE_VALUE
+ == (stdHandles[2] = CreateNamedPipeW(errPipeName, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, PIPE_SIZE,
+ PIPE_SIZE, PIPE_TIMEOUT, NULL)))) {
CloseHandle(stdHandles[0]);
- CloseHandle(stdHandles[1]);
- CloseHandle(stdHandles[2]);
+ CloseHandle(stdHandles[1]);
+ CloseHandle(stdHandles[2]);
ThrowByName(env, "java/io/IOException", "CreatePipe");
return 0;
- }
+ }
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Opened pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
OutputDebugStringW(buffer);
#endif
-
nCmdTokens = (*env)->GetArrayLength(env, cmdarray);
- nEnvVars = (*env)->GetArrayLength(env, envp);
+ nEnvVars = (*env)->GetArrayLength(env, envp);
pCurProcInfo = createProcInfo();
- if(NULL == pCurProcInfo)
- {
+ if (NULL == pCurProcInfo) {
ThrowByName(env, "java/io/IOException", "Too many processes");
return 0;
- }
+ }
// Construct starter's command line
- swprintf(eventBreakName, sizeof(eventBreakName)/sizeof(eventBreakName[0]), L"SABreak%04x%08x", pid, nLocalCounter);
- swprintf(eventWaitName, sizeof(eventWaitName)/sizeof(eventWaitName[0]), L"SAWait%04x%08x", pid, nLocalCounter);
- swprintf(eventTerminateName, sizeof(eventTerminateName)/sizeof(eventTerminateName[0]), L"SATerm%04x%08x", pid, nLocalCounter);
- swprintf(eventKillName, sizeof(eventKillName)/sizeof(eventKillName[0]), L"SAKill%04x%08x", pid, nLocalCounter);
- swprintf(eventCtrlcName, sizeof(eventCtrlcName)/sizeof(eventCtrlcName[0]), L"SACtrlc%04x%08x", pid, nLocalCounter);
+ swprintf(eventBreakName, sizeof(eventBreakName) / sizeof(eventBreakName[0]), L"SABreak%04x%08x", pid,
+ nLocalCounter);
+ swprintf(eventWaitName, sizeof(eventWaitName) / sizeof(eventWaitName[0]), L"SAWait%04x%08x", pid, nLocalCounter);
+ swprintf(eventTerminateName, sizeof(eventTerminateName) / sizeof(eventTerminateName[0]), L"SATerm%04x%08x", pid,
+ nLocalCounter);
+ swprintf(eventKillName, sizeof(eventKillName) / sizeof(eventKillName[0]), L"SAKill%04x%08x", pid, nLocalCounter);
+ swprintf(eventCtrlcName, sizeof(eventCtrlcName) / sizeof(eventCtrlcName[0]), L"SACtrlc%04x%08x", pid,
+ nLocalCounter);
- pCurProcInfo->eventBreak = CreateEventW(NULL, FALSE, FALSE, eventBreakName);
- if(NULL == pCurProcInfo->eventBreak || GetLastError() == ERROR_ALREADY_EXISTS)
- {
- ThrowByName(env, "java/io/IOException", "Cannot create event");
- return 0;
- }
- pCurProcInfo->eventWait = CreateEventW(NULL, TRUE, FALSE, eventWaitName);
+ pCurProcInfo->eventBreak = CreateEventW(NULL, FALSE, FALSE, eventBreakName);
+ if (NULL == pCurProcInfo->eventBreak || GetLastError() == ERROR_ALREADY_EXISTS) {
+ ThrowByName(env, "java/io/IOException", "Cannot create event");
+ return 0;
+ }
+ pCurProcInfo->eventWait = CreateEventW(NULL, TRUE, FALSE, eventWaitName);
pCurProcInfo->eventTerminate = CreateEventW(NULL, FALSE, FALSE, eventTerminateName);
- pCurProcInfo->eventKill = CreateEventW(NULL, FALSE, FALSE, eventKillName);
- pCurProcInfo->eventCtrlc = CreateEventW(NULL, FALSE, FALSE, eventCtrlcName);
+ pCurProcInfo->eventKill = CreateEventW(NULL, FALSE, FALSE, eventKillName);
+ pCurProcInfo->eventCtrlc = CreateEventW(NULL, FALSE, FALSE, eventCtrlcName);
- swprintf(szCmdLine, nCmdLineLength, L"\"%sstarter.exe\" %i %i %s %s %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName, eventKillName, eventCtrlcName);
+ swprintf(szCmdLine, nCmdLineLength, L"\"%sstarter.exe\" %i %i %s %s %s %s %s ", path, pid, nLocalCounter,
+ eventBreakName, eventWaitName, eventTerminateName, eventKillName, eventCtrlcName);
nPos = wcslen(szCmdLine);
// Prepare command line
- for(i = 0; i < nCmdTokens; ++i)
- {
+ for (i = 0; i < nCmdTokens; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, cmdarray, i);
- jsize len = (*env)->GetStringLength(env, item);
+ jsize len = (*env)->GetStringLength(env, item);
int nCpyLen;
- const wchar_t * str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
- if(NULL != str)
- {
- int requiredSize= nPos+len+2;
- if (requiredSize > 32*1024) {
+ const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
+ if (NULL != str) {
+ int requiredSize = nPos + len + 2;
+ if (requiredSize > 32 * 1024) {
ThrowByName(env, "java/io/IOException", "Command line too long");
return 0;
- }
+ }
ensureSize(&szCmdLine, &nCmdLineLength, requiredSize);
if (NULL == szCmdLine) {
ThrowByName(env, "java/io/IOException", "Not enough memory");
return 0;
}
-
- if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos)))
- {
+
+ if (0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos))) {
ThrowByName(env, "java/io/IOException", "Command line too long");
return 0;
}
nPos += nCpyLen;
szCmdLine[nPos] = _T(' ');
++nPos;
- (*env)->ReleaseStringChars(env, item, (const jchar *)str);
+ (*env)->ReleaseStringChars(env, item, (const jchar*) str);
}
}
szCmdLine[nPos] = _T('\0');
@@ -312,32 +300,28 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
OutputDebugStringW(buffer);
#endif
// Prepare environment block
- if (nEnvVars > 0)
- {
+ if (nEnvVars > 0) {
nPos = 0;
- szEnvBlock = (wchar_t *)malloc(nBlkSize * sizeof(wchar_t));
- for(i = 0; i < nEnvVars; ++i)
- {
+ szEnvBlock = (wchar_t*) malloc(nBlkSize * sizeof(wchar_t));
+ for (i = 0; i < nEnvVars; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, envp, i);
- jsize len = (*env)->GetStringLength(env, item);
- const wchar_t * str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
- if(NULL != str)
+ jsize len = (*env)->GetStringLength(env, item);
+ const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
+ if (NULL != str) {
+ while ((nBlkSize - nPos) <= (len + 2)) // +2 for two '\0'
{
- while((nBlkSize - nPos) <= (len + 2)) // +2 for two '\0'
- {
nBlkSize += MAX_ENV_SIZE;
- szEnvBlock = (wchar_t *)realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
- if(NULL == szEnvBlock)
- {
+ szEnvBlock = (wchar_t*) realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
+ if (NULL == szEnvBlock) {
ThrowByName(env, "java/io/IOException", "Not enough memory");
return 0;
- }
+ }
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Realloc environment block; new length is %i \n"), nBlkSize);
OutputDebugStringW(buffer);
#endif
- }
+ }
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("%s\n"), str);
OutputDebugStringW(buffer);
@@ -346,35 +330,28 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
nPos += len;
szEnvBlock[nPos] = _T('\0');
++nPos;
- (*env)->ReleaseStringChars(env, item, (const jchar *)str);
- }
+ (*env)->ReleaseStringChars(env, item, (const jchar*) str);
}
- szEnvBlock[nPos] = _T('\0');
}
+ szEnvBlock[nPos] = _T('\0');
+ }
-
-
- if (dir != 0)
- {
- const wchar_t * str = (const wchar_t *)(*env)->GetStringChars(env, dir, 0);
- if(NULL != str)
- {
+ if (dir != 0) {
+ const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, dir, 0);
+ if (NULL != str) {
cwd = wcsdup(str);
- (*env)->ReleaseStringChars(env, dir, (const jchar *)str);
- }
+ (*env)->ReleaseStringChars(env, dir, (const jchar*) str);
}
+ }
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
+ si.dwFlags |= STARTF_USESHOWWINDOW;
+ si.wShowWindow = SW_HIDE; // Processes in the Process Group are hidden
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
- si.dwFlags |= STARTF_USESHOWWINDOW;
- si.wShowWindow = SW_HIDE; // Processes in the Process Group are hidden
-
-
-
- SetHandleInformation(stdHandles[0], HANDLE_FLAG_INHERIT, FALSE);
- SetHandleInformation(stdHandles[1], HANDLE_FLAG_INHERIT, FALSE);
- SetHandleInformation(stdHandles[2], HANDLE_FLAG_INHERIT, FALSE);
+ SetHandleInformation(stdHandles[0], HANDLE_FLAG_INHERIT, FALSE);
+ SetHandleInformation(stdHandles[1], HANDLE_FLAG_INHERIT, FALSE);
+ SetHandleInformation(stdHandles[2], HANDLE_FLAG_INHERIT, FALSE);
flags = CREATE_NEW_CONSOLE;
flags |= CREATE_NO_WINDOW;
@@ -385,63 +362,53 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
#endif
// launches starter; we need it to create another console group to correctly process
// emulation of SYSint signal (Ctrl-C)
- ret = CreateProcessW(0, /* executable name */
- szCmdLine, /* command line */
- 0, /* process security attribute */
- 0, /* thread security attribute */
- FALSE, /* inherits system handles */
- flags, /* normal attached process */
- szEnvBlock, /* environment block */
- cwd, /* change to the new current directory */
- &si, /* (in) startup information */
- &pi); /* (out) process information */
+ ret = CreateProcessW(0, /* executable name */
+ szCmdLine, /* command line */
+ 0, /* process security attribute */
+ 0, /* thread security attribute */
+ FALSE, /* inherits system handles */
+ flags, /* normal attached process */
+ szEnvBlock, /* environment block */
+ cwd, /* change to the new current directory */
+ &si, /* (in) startup information */
+ &pi); /* (out) process information */
- if(NULL != cwd)
- free((void *)cwd);
+ if (NULL != cwd)
+ free((void*) cwd);
- if(NULL != szEnvBlock)
+ if (NULL != szEnvBlock)
free(szEnvBlock);
- if(NULL != szCmdLine)
- free(szCmdLine);
-
- if (!ret) // Launching error
- {
- char * lpMsgBuf;
+ if (NULL != szCmdLine)
+ free(szCmdLine);
+
+ if (!ret) // Launching error
+ {
+ char *lpMsgBuf;
CloseHandle(stdHandles[0]);
CloseHandle(stdHandles[1]);
- CloseHandle(stdHandles[2]);
- FormatMessageA(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (char *)&lpMsgBuf,
- 0,
- NULL
- );
+ CloseHandle(stdHandles[2]);
+ FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (char*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
- LocalFree( lpMsgBuf );
+ LocalFree(lpMsgBuf);
cleanUpProcBlock(pCurProcInfo);
ret = -1;
- }
- else
- {
+ } else {
HANDLE h[2];
int what;
EnterCriticalSection(&cs);
- pCurProcInfo -> pid = pi.dwProcessId;
- h[0] = pCurProcInfo -> eventWait;
+ pCurProcInfo->pid = pi.dwProcessId;
+ h[0] = pCurProcInfo->eventWait;
h[1] = pi.hProcess;
-
- what = WaitForMultipleObjects(2, h, FALSE, INFINITE);
- if(what != WAIT_OBJECT_0) // CreateProcess failed
- {
+
+ what = WaitForMultipleObjects(2, h, FALSE, INFINITE);
+ if (what != WAIT_OBJECT_0) // CreateProcess failed
+ {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Process %i failed\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
@@ -451,38 +418,35 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Process failed\n"));
#endif
- }
- else
- {
- ret = (long)(pCurProcInfo -> uid);
-
+ } else {
+ ret = (long) (pCurProcInfo->uid);
+
// Prepare stream handlers to return to java program
for (jsize i = 0; i < 3; i++) {
- jobject chan = (*env)->NewObject(env, channelClass, channelConstructor, (jlong)stdHandles[i]);
+ jobject chan = (*env)->NewObject(env, channelClass, channelConstructor, (jlong) stdHandles[i]);
(*env)->SetObjectArrayElement(env, channels, i, chan);
}
// do the cleanup so launch the according thread
// create a copy of the PROCESS_INFORMATION as this might get destroyed
- piCopy = (PROCESS_INFORMATION *)malloc(sizeof(PROCESS_INFORMATION));
+ piCopy = (PROCESS_INFORMATION*) malloc(sizeof(PROCESS_INFORMATION));
memcpy(piCopy, &pi, sizeof(PROCESS_INFORMATION));
- _beginthread(waitProcTermination, 0, (void *)piCopy);
+ _beginthread(waitProcTermination, 0, (void*) piCopy);
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Process started\n"));
#endif
- }
+ }
LeaveCriticalSection(&cs);
- }
+ }
CloseHandle(pi.hThread);
- return ret;
+ return ret;
}
-
/////////////////////////////////////////////////////////////////////////////////////
// Launcher; just launches process and don't care about it any more
// Arguments: (see Spawner.java)
@@ -493,183 +457,151 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
- (JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *env, jobject process,
+ jobjectArray cmdarray, jobjectArray envp, jstring dir) {
- SECURITY_ATTRIBUTES sa;
- PROCESS_INFORMATION pi = {0};
- STARTUPINFOW si;
+ SECURITY_ATTRIBUTES sa;
+ PROCESS_INFORMATION pi = { 0 };
+ STARTUPINFOW si;
DWORD flags = 0;
- wchar_t * cwd = NULL;
- wchar_t * envBlk = NULL;
- int ret = 0;
+ wchar_t *cwd = NULL;
+ wchar_t *envBlk = NULL;
+ int ret = 0;
jsize nCmdTokens = 0;
jsize nEnvVars = 0;
int i;
int nPos;
- int nCmdLineLength= 0;
- wchar_t * szCmdLine= 0;
- int nBlkSize = MAX_ENV_SIZE;
- wchar_t * szEnvBlock = NULL;
+ int nCmdLineLength = 0;
+ wchar_t *szCmdLine = 0;
+ int nBlkSize = MAX_ENV_SIZE;
+ wchar_t *szEnvBlock = NULL;
- nCmdLineLength= MAX_CMD_SIZE;
- szCmdLine= (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
- szCmdLine[0]= 0;
-
- sa.nLength = sizeof(sa);
- sa.lpSecurityDescriptor = 0;
- sa.bInheritHandle = TRUE;
+ nCmdLineLength = MAX_CMD_SIZE;
+ szCmdLine = (wchar_t*) malloc(nCmdLineLength * sizeof(wchar_t));
+ szCmdLine[0] = 0;
+ sa.nLength = sizeof(sa);
+ sa.lpSecurityDescriptor = 0;
+ sa.bInheritHandle = TRUE;
nCmdTokens = (*env)->GetArrayLength(env, cmdarray);
- nEnvVars = (*env)->GetArrayLength(env, envp);
+ nEnvVars = (*env)->GetArrayLength(env, envp);
nPos = 0;
// Prepare command line
- for(i = 0; i < nCmdTokens; ++i)
- {
+ for (i = 0; i < nCmdTokens; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, cmdarray, i);
- jsize len = (*env)->GetStringLength(env, item);
+ jsize len = (*env)->GetStringLength(env, item);
int nCpyLen;
- const wchar_t * str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
- if(NULL != str)
- {
- int requiredSize= nPos+len+2;
- if (requiredSize > 32*1024) {
+ const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
+ if (NULL != str) {
+ int requiredSize = nPos + len + 2;
+ if (requiredSize > 32 * 1024) {
ThrowByName(env, "java/io/IOException", "Command line too long");
return 0;
- }
+ }
ensureSize(&szCmdLine, &nCmdLineLength, requiredSize);
if (NULL == szCmdLine) {
ThrowByName(env, "java/io/IOException", "Not enough memory");
return 0;
}
-
- if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos)))
- {
+
+ if (0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos))) {
ThrowByName(env, "java/io/Exception", "Command line too long");
return 0;
- }
+ }
nPos += nCpyLen;
szCmdLine[nPos] = _T(' ');
++nPos;
- (*env)->ReleaseStringChars(env, item, (const jchar *)str);
- }
+ (*env)->ReleaseStringChars(env, item, (const jchar*) str);
}
+ }
szCmdLine[nPos] = _T('\0');
// Prepare environment block
- if (nEnvVars > 0)
- {
- szEnvBlock = (wchar_t *)malloc(nBlkSize * sizeof(wchar_t));
+ if (nEnvVars > 0) {
+ szEnvBlock = (wchar_t*) malloc(nBlkSize * sizeof(wchar_t));
nPos = 0;
- for(i = 0; i < nEnvVars; ++i)
- {
+ for (i = 0; i < nEnvVars; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, envp, i);
- jsize len = (*env)->GetStringLength(env, item);
- const wchar_t * str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
- if(NULL != str)
+ jsize len = (*env)->GetStringLength(env, item);
+ const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
+ if (NULL != str) {
+ while ((nBlkSize - nPos) <= (len + 2)) // +2 for two '\0'
{
- while((nBlkSize - nPos) <= (len + 2)) // +2 for two '\0'
- {
nBlkSize += MAX_ENV_SIZE;
- szEnvBlock = (wchar_t *)realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
- if(NULL == szEnvBlock)
- {
+ szEnvBlock = (wchar_t*) realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
+ if (NULL == szEnvBlock) {
ThrowByName(env, "java/io/Exception", "Not enough memory");
return 0;
- }
}
+ }
wcsncpy(szEnvBlock + nPos, str, len);
nPos += len;
szEnvBlock[nPos] = _T('\0');
++nPos;
- (*env)->ReleaseStringChars(env, item, (const jchar *)str);
- }
+ (*env)->ReleaseStringChars(env, item, (const jchar*) str);
}
- szEnvBlock[nPos] = _T('\0');
+ }
+ szEnvBlock[nPos] = _T('\0');
envBlk = szEnvBlock;
- }
+ }
-
-
- if (dir != 0)
- {
- const wchar_t * str = (const wchar_t *)(*env)->GetStringChars(env, dir, 0);
- if(NULL != str)
- {
+ if (dir != 0) {
+ const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, dir, 0);
+ if (NULL != str) {
cwd = wcsdup(str);
- (*env)->ReleaseStringChars(env, dir, (const jchar *)str);
- }
+ (*env)->ReleaseStringChars(env, dir, (const jchar*) str);
}
+ }
-
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
-
-
-
-
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
flags = CREATE_NEW_CONSOLE;
flags |= CREATE_UNICODE_ENVIRONMENT;
- ret = CreateProcessW(0, /* executable name */
- szCmdLine, /* command line */
- 0, /* process security attribute */
- 0, /* thread security attribute */
- TRUE, /* inherits system handles */
- flags, /* normal attached process */
- envBlk, /* environment block */
- cwd, /* change to the new current directory */
- &si, /* (in) startup information */
- &pi); /* (out) process information */
+ ret = CreateProcessW(0, /* executable name */
+ szCmdLine, /* command line */
+ 0, /* process security attribute */
+ 0, /* thread security attribute */
+ TRUE, /* inherits system handles */
+ flags, /* normal attached process */
+ envBlk, /* environment block */
+ cwd, /* change to the new current directory */
+ &si, /* (in) startup information */
+ &pi); /* (out) process information */
-
-
- if(NULL != cwd)
+ if (NULL != cwd)
free(cwd);
- if(NULL != szEnvBlock)
+ if (NULL != szEnvBlock)
free(szEnvBlock);
- if(NULL != szCmdLine)
+ if (NULL != szCmdLine)
free(szCmdLine);
- if (!ret) // error
- {
- char * lpMsgBuf;
+ if (!ret) // error
+ {
+ char *lpMsgBuf;
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (wchar_t *)&lpMsgBuf,
- 0,
- NULL
- );
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
+ GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
- LocalFree( lpMsgBuf );
+ LocalFree(lpMsgBuf);
ret = -1;
- }
- else
- {
+ } else {
// Clean-up
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
- ret = (long)pi.dwProcessId; //hProcess;
- }
+ ret = (long) pi.dwProcessId; //hProcess;
+ }
-
- return ret;
+ return ret;
}
-
/////////////////////////////////////////////////////////////////////////////////////
// Emulation of the signal raising
// Arguments: (see Spawner.java)
@@ -679,9 +611,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
- (JNIEnv * env, jobject process, jint uid, jint signal)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject process, jint uid,
+ jint signal) {
jint ret = 0;
HANDLE hProc;
@@ -689,10 +620,10 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
#ifdef DEBUG_MONITOR
wchar_t buffer[100];
#endif
-
- if(NULL == pCurProcInfo) {
- if(SIG_INT == signal) { // Try another way
- return interruptProcess(uid) ;
+
+ if (NULL == pCurProcInfo) {
+ if (SIG_INT == signal) { // Try another way
+ return interruptProcess(uid);
}
return -1;
}
@@ -701,69 +632,65 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Spawner received signal %i for process %i\n"), signal, pCurProcInfo -> pid);
OutputDebugStringW(buffer);
#endif
-
- hProc = OpenProcess(SYNCHRONIZE, 0, pCurProcInfo -> pid);
- if(NULL == hProc)
+ hProc = OpenProcess(SYNCHRONIZE, 0, pCurProcInfo->pid);
+
+ if (NULL == hProc)
return -1;
- switch(signal)
- {
- case SIG_NOOP:
- // Wait 0 msec -just check if the process has been still running
- ret = ((WAIT_TIMEOUT == WaitForSingleObject(hProc, 0)) ? 0 : -1);
- break;
- case SIG_HUP:
- // Temporary do nothing
- ret = 0;
- break;
- case SIG_TERM:
+ switch (signal) {
+ case SIG_NOOP:
+ // Wait 0 msec -just check if the process has been still running
+ ret = ((WAIT_TIMEOUT == WaitForSingleObject(hProc, 0)) ? 0 : -1);
+ break;
+ case SIG_HUP:
+ // Temporary do nothing
+ ret = 0;
+ break;
+ case SIG_TERM:
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Spawner received TERM signal for process %i\n"),
pCurProcInfo -> pid);
OutputDebugStringW(buffer);
#endif
- SetEvent(pCurProcInfo -> eventTerminate);
+ SetEvent(pCurProcInfo->eventTerminate);
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Spawner signaled TERM event\n"));
#endif
- ret = 0;
- break;
+ ret = 0;
+ break;
- case SIG_KILL:
+ case SIG_KILL:
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Spawner received KILL signal for process %i\n"),
pCurProcInfo -> pid);
OutputDebugStringW(buffer);
#endif
- SetEvent(pCurProcInfo -> eventKill);
+ SetEvent(pCurProcInfo->eventKill);
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Spawner signaled KILL event\n"));
#endif
- ret = 0;
- break;
- case SIG_INT:
- ResetEvent(pCurProcInfo -> eventWait);
- SetEvent(pCurProcInfo -> eventBreak);
- ret = (WaitForSingleObject(pCurProcInfo -> eventWait, 100) == WAIT_OBJECT_0);
- break;
- case CTRLC:
- ResetEvent(pCurProcInfo -> eventWait);
- SetEvent(pCurProcInfo -> eventCtrlc);
- ret = (WaitForSingleObject(pCurProcInfo -> eventWait, 100) == WAIT_OBJECT_0);
- break;
- default:
- break;
- }
+ ret = 0;
+ break;
+ case SIG_INT:
+ ResetEvent(pCurProcInfo->eventWait);
+ SetEvent(pCurProcInfo->eventBreak);
+ ret = (WaitForSingleObject(pCurProcInfo->eventWait, 100) == WAIT_OBJECT_0);
+ break;
+ case CTRLC:
+ ResetEvent(pCurProcInfo->eventWait);
+ SetEvent(pCurProcInfo->eventCtrlc);
+ ret = (WaitForSingleObject(pCurProcInfo->eventWait, 100) == WAIT_OBJECT_0);
+ break;
+ default:
+ break;
+ }
CloseHandle(hProc);
return ret;
-
}
-
-
/////////////////////////////////////////////////////////////////////////////////////
// Wait for process termination
// Arguments: (see Spawner.java)
@@ -772,41 +699,32 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
- (JNIEnv * env, jobject process, jint uid)
-{
- DWORD exit_code = -1;
- int what=0;
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv *env, jobject process, jint uid) {
+ DWORD exit_code = -1;
+ int what = 0;
HANDLE hProc;
pProcInfo_t pCurProcInfo = findProcInfo(uid);
- if(NULL == pCurProcInfo)
- return -1;
-
- hProc = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, 0, pCurProcInfo -> pid);
-
- if(NULL == hProc)
+ if (NULL == pCurProcInfo)
return -1;
- what = WaitForSingleObject(hProc, INFINITE);
+ hProc = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, 0, pCurProcInfo->pid);
+ if (NULL == hProc)
+ return -1;
- if (what == WAIT_OBJECT_0)
- {
+ what = WaitForSingleObject(hProc, INFINITE);
+
+ if (what == WAIT_OBJECT_0) {
GetExitCodeProcess(hProc, &exit_code);
- }
+ }
-
- if(hProc)
+ if (hProc)
CloseHandle(hProc);
- return exit_code;
+ return exit_code;
}
-
-
-
-
// Utilities
/////////////////////////////////////////////////////////////////////////////////////
@@ -815,51 +733,43 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
// [in] name - name of exception class
// [in] message to assign thi event
/////////////////////////////////////////////////////////////////////////////////////
-void ThrowByName(JNIEnv *env, const char *name, const char *msg)
-{
- jclass cls = (*env)->FindClass(env, name);
+void ThrowByName(JNIEnv *env, const char *name, const char *msg) {
+ jclass cls = (*env)->FindClass(env, name);
- if (cls != 0) /* Otherwise an exception has already been thrown */
- (*env)->ThrowNew(env, cls, msg);
+ if (cls != 0) /* Otherwise an exception has already been thrown */
+ (*env)->ThrowNew(env, cls, msg);
- /* It's a good practice to clean up the local references. */
- (*env)->DeleteLocalRef(env, cls);
+ /* It's a good practice to clean up the local references. */
+ (*env)->DeleteLocalRef(env, cls);
}
-
-
-
/////////////////////////////////////////////////////////////////////////////////////
// Create process description block.
// Arguments: no
// Return : pointer to the process descriptor
/////////////////////////////////////////////////////////////////////////////////////
-pProcInfo_t createProcInfo()
-{
+pProcInfo_t createProcInfo() {
int i;
pProcInfo_t p = NULL;
EnterCriticalSection(&cs);
- if(NULL == pInfo)
- {
- pInfo = (pProcInfo_t)malloc(sizeof(procInfo_t) * MAX_PROCS);
+ if (NULL == pInfo) {
+ pInfo = (pProcInfo_t) malloc(sizeof(procInfo_t) * MAX_PROCS);
ZeroMemory(pInfo, sizeof(procInfo_t) * MAX_PROCS);
- }
+ }
- for(i = 0; i < MAX_PROCS; ++i)
- {
- if(pInfo[i].pid == 0)
- {
+ for (i = 0; i < MAX_PROCS; ++i) {
+ if (pInfo[i].pid == 0) {
pInfo[i].pid = -1;
pInfo[i].uid = ++procCounter;
p = pInfo + i;
break;
- }
}
-
+ }
+
LeaveCriticalSection(&cs);
-
+
return p;
}
@@ -868,21 +778,18 @@ pProcInfo_t createProcInfo()
// Arguments: no
// Return : pointer to the process descriptor
/////////////////////////////////////////////////////////////////////////////////////
-pProcInfo_t findProcInfo(int uid)
-{
+pProcInfo_t findProcInfo(int uid) {
int i;
pProcInfo_t p = NULL;
- if(NULL == pInfo)
+ if (NULL == pInfo)
return NULL;
- for(i = 0; i < MAX_PROCS; ++i)
- {
- if(pInfo[i].uid == uid)
- {
+ for (i = 0; i < MAX_PROCS; ++i) {
+ if (pInfo[i].uid == uid) {
p = pInfo + i;
break;
- }
}
+ }
return p;
}
@@ -892,37 +799,31 @@ pProcInfo_t findProcInfo(int uid)
// Arguments:
// pCurProcInfo - pointer to descriptor to clean up
// Return : no
-void cleanUpProcBlock(pProcInfo_t pCurProcInfo)
-{
- if(0 != pCurProcInfo -> eventBreak)
- {
- CloseHandle(pCurProcInfo -> eventBreak);
- pCurProcInfo -> eventBreak = 0;
- }
- if(0 != pCurProcInfo -> eventWait)
- {
- CloseHandle(pCurProcInfo -> eventWait);
- pCurProcInfo -> eventWait = 0;
- }
- if(0 != pCurProcInfo -> eventTerminate)
- {
- CloseHandle(pCurProcInfo -> eventTerminate);
- pCurProcInfo -> eventTerminate = 0;
- }
+void cleanUpProcBlock(pProcInfo_t pCurProcInfo) {
+ if (0 != pCurProcInfo->eventBreak) {
+ CloseHandle(pCurProcInfo->eventBreak);
+ pCurProcInfo->eventBreak = 0;
+ }
+ if (0 != pCurProcInfo->eventWait) {
+ CloseHandle(pCurProcInfo->eventWait);
+ pCurProcInfo->eventWait = 0;
+ }
+ if (0 != pCurProcInfo->eventTerminate) {
+ CloseHandle(pCurProcInfo->eventTerminate);
+ pCurProcInfo->eventTerminate = 0;
+ }
- if(0 != pCurProcInfo -> eventKill)
- {
- CloseHandle(pCurProcInfo -> eventKill);
- pCurProcInfo -> eventKill = 0;
- }
+ if (0 != pCurProcInfo->eventKill) {
+ CloseHandle(pCurProcInfo->eventKill);
+ pCurProcInfo->eventKill = 0;
+ }
- if(0 != pCurProcInfo -> eventCtrlc)
- {
- CloseHandle(pCurProcInfo -> eventCtrlc);
- pCurProcInfo -> eventCtrlc = 0;
- }
+ if (0 != pCurProcInfo->eventCtrlc) {
+ CloseHandle(pCurProcInfo->eventCtrlc);
+ pCurProcInfo->eventCtrlc = 0;
+ }
- pCurProcInfo -> pid = 0;
+ pCurProcInfo->pid = 0;
}
/////////////////////////////////////////////////////////////////////////////////////
@@ -931,7 +832,7 @@ void cleanUpProcBlock(pProcInfo_t pCurProcInfo)
// pv - pointer to PROCESS_INFORMATION struct
// Return : no
/////////////////////////////////////////////////////////////////////////////////////
-void _cdecl waitProcTermination(void* pv)
+void _cdecl waitProcTermination(void* pv)
{
PROCESS_INFORMATION *pi = (PROCESS_INFORMATION *)pv;
int i;
@@ -948,9 +849,9 @@ void _cdecl waitProcTermination(void* pv)
{
cleanUpProcBlock(pInfo + i);
#ifdef DEBUG_MONITOR
- swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("waitProcTermination: set PID %i to 0\n"),
- pi->dwProcessId);
- OutputDebugStringW(buffer);
+ swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("waitProcTermination: set PID %i to 0\n"),
+ pi->dwProcessId);
+ OutputDebugStringW(buffer);
#endif
}
}
@@ -968,8 +869,7 @@ void _cdecl waitProcTermination(void* pv)
// availSpace - size of the target buffer
// Return :number of bytes used in target, or -1 in case of error
/////////////////////////////////////////////////////////////////////////////////////
-int copyTo(wchar_t * target, const wchar_t * source, int cpyLength, int availSpace)
-{
+int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace) {
BOOL bSlash = FALSE;
int i = 0, j = 0;
int totCpyLength = cpyLength;
@@ -980,62 +880,50 @@ int copyTo(wchar_t * target, const wchar_t * source, int cpyLength, int availSpa
int nQuotationMode = 0;
-
-
- if(availSpace <= cpyLength) // = to reserve space for final '\0'
+ if (availSpace <= cpyLength) // = to reserve space for final '\0'
return -1;
- if((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1)))
- {
+ if ((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1))) {
nQuotationMode = QUOTATION_DONE;
- }
- else
- if(wcschr(source, _T(' ')) == NULL)
- {
+ } else if (wcschr(source, _T(' ')) == NULL) {
// No reason to quote term because it doesn't have embedded spaces
nQuotationMode = QUOTATION_NONE;
- }
- else
- {
+ } else {
// Needs to be quoted
nQuotationMode = QUOTATION_DO;
*target = _T('\"');
++j;
- }
+ }
-
- for(; i < cpyLength; ++i, ++j)
- {
- if(source[i] == _T('\\'))
+ for (; i < cpyLength; ++i, ++j) {
+ if (source[i] == _T('\\'))
bSlash = TRUE;
- else
- {
+ else {
// Don't escape embracing quotation marks
- if((source[i] == _T('\"')) && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))) ) )
+ if ((source[i] == _T('\"'))
+ && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))))) {
+ if (!bSlash) // If still not escaped
{
- if(!bSlash) // If still not escaped
- {
- if(j == availSpace)
+ if (j == availSpace)
return -1;
target[j] = _T('\\');
++j;
- }
}
- bSlash = FALSE;
}
-
- if(j == availSpace)
- return -1;
- target[j] = source[i];
+ bSlash = FALSE;
}
- if(nQuotationMode == QUOTATION_DO)
- {
- if(j == availSpace)
+ if (j == availSpace)
+ return -1;
+ target[j] = source[i];
+ }
+
+ if (nQuotationMode == QUOTATION_DO) {
+ if (j == availSpace)
return -1;
target[j] = _T('\"');
++j;
- }
+ }
return j;
}
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/include/winpty.h b/core/org.eclipse.cdt.core.native/native_src/win/include/winpty.h
index 41e36434812..ddd525e2da4 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/include/winpty.h
+++ b/core/org.eclipse.cdt.core.native/native_src/win/include/winpty.h
@@ -47,7 +47,7 @@ typedef struct winpty_s winpty_t;
*
* This function creates a new agent process and connects to it.
*/
-WINPTY_API winpty_t *winpty_open(int cols, int rows);
+WINPTY_API winpty_t* winpty_open(int cols, int rows);
/*
* Start a child process. Either (but not both) of appname and cmdline may
@@ -62,11 +62,8 @@ WINPTY_API winpty_t *winpty_open(int cols, int rows);
*
* Returns 0 on success or a Win32 error code on failure.
*/
-WINPTY_API int winpty_start_process(winpty_t *pc,
- const wchar_t *appname,
- const wchar_t *cmdline,
- const wchar_t *cwd,
- const wchar_t *env);
+WINPTY_API int winpty_start_process(winpty_t *pc, const wchar_t *appname, const wchar_t *cmdline, const wchar_t *cwd,
+ const wchar_t *env);
/*
* Returns the exit code of the process started with winpty_start_process,
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/iostream.c b/core/org.eclipse.cdt.core.native/native_src/win/iostream.c
index 50ff9849188..1d2278076c9 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/iostream.c
+++ b/core/org.eclipse.cdt.core.native/native_src/win/iostream.c
@@ -29,8 +29,7 @@ void ThrowByName(JNIEnv *env, const char *name, const char *msg);
#define BUFF_SIZE (1024)
-static HANDLE channelToHandle(JNIEnv * env, jobject channel)
-{
+static HANDLE channelToHandle(JNIEnv *env, jobject channel) {
if (channel == 0) {
ThrowByName(env, "java/io/IOException", "Invalid channel object");
return NULL;
@@ -49,47 +48,38 @@ static HANDLE channelToHandle(JNIEnv * env, jobject channel)
}
jlong handle = (*env)->GetLongField(env, channel, fid);
- return (HANDLE)handle;
+ return (HANDLE) handle;
}
/* Inaccessible static: skipBuffer */
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0
- (JNIEnv * env, jobject proc, jobject channel, jbyteArray buf, jint len)
-{
- jbyte tmpBuf[BUFF_SIZE];
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv *env, jobject proc,
+ jobject channel, jbyteArray buf, jint len) {
+ jbyte tmpBuf[BUFF_SIZE];
int nBuffOffset = 0;
HANDLE handle = channelToHandle(env, channel);
#ifdef DEBUG_MONITOR
_TCHAR buffer[1000];
#endif
OVERLAPPED overlapped;
- overlapped.Offset = 0;
- overlapped.OffsetHigh = 0;
- overlapped.hEvent = CreateEvent(NULL, // no security attribute
- TRUE, // manual-reset event
- TRUE, // initial state = signaled
- NULL); // unnamed event object
-
- if(NULL == overlapped.hEvent) {
- char * lpMsgBuf;
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (wchar_t *) &lpMsgBuf,
- 0,
- NULL
- );
+ overlapped.Offset = 0;
+ overlapped.OffsetHigh = 0;
+ overlapped.hEvent = CreateEvent(NULL, // no security attribute
+ TRUE, // manual-reset event
+ TRUE, // initial state = signaled
+ NULL); // unnamed event object
+
+ if (NULL == overlapped.hEvent) {
+ char *lpMsgBuf;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
+ GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
- LocalFree( lpMsgBuf );
+ LocalFree(lpMsgBuf);
}
#ifdef DEBUG_MONITOR
@@ -99,55 +89,41 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
#endif
#endif
- while(len > nBuffOffset)
- {
+ while (len > nBuffOffset) {
DWORD nNumberOfBytesToRead = min(len - nBuffOffset, BUFF_SIZE);
DWORD nNumberOfBytesRead;
- if(0 == ReadFile(handle, tmpBuf, nNumberOfBytesToRead, &nNumberOfBytesRead, &overlapped ))
- {
+ if (0 == ReadFile(handle, tmpBuf, nNumberOfBytesToRead, &nNumberOfBytesRead, &overlapped)) {
int err = GetLastError();
- if(err == ERROR_IO_PENDING)
- {
+ if (err == ERROR_IO_PENDING) {
// asynchronous i/o is still in progress
// check on the results of the asynchronous read
- if(GetOverlappedResult(handle, &overlapped,
- &nNumberOfBytesRead, TRUE))
+ if (GetOverlappedResult(handle, &overlapped, &nNumberOfBytesRead, TRUE))
err = 0;
// if there was a problem ...
else
err = GetLastError();
- }
- if(err == ERROR_BROKEN_PIPE) // Pipe was closed
+ }
+ if (err == ERROR_BROKEN_PIPE) // Pipe was closed
break;
- if(err != 0)
- {
- char * lpMsgBuf;
+ if (err != 0) {
+ char *lpMsgBuf;
#ifdef DEBUG_MONITOR
_stprintf(buffer, _T("Read failed - %i, error %i\n"), fd, err);
OutputDebugStringW(buffer);
#endif
- if(err != ERROR_MORE_DATA) // Otherwise error means just that there are more data
- { // than buffer can accept
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (wchar_t *) &lpMsgBuf,
- 0,
- NULL
- );
+ if (err != ERROR_MORE_DATA) // Otherwise error means just that there are more data
+ { // than buffer can accept
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
- LocalFree( lpMsgBuf );
+ LocalFree(lpMsgBuf);
nBuffOffset = 0;
break;
- }
- else
- {
+ } else {
// buffer overflow?
// according to msdn this happens in message read mode only
#ifdef DEBUG_MONITOR
@@ -156,26 +132,24 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
#endif
// nNumberOfBytesRead can be 0 here for unknown reason (bug 269223)
nNumberOfBytesRead = nNumberOfBytesToRead;
- }
}
}
- if(nNumberOfBytesRead > 0)
+ }
+ if (nNumberOfBytesRead > 0)
(*env)->SetByteArrayRegion(env, buf, nBuffOffset, nNumberOfBytesRead, tmpBuf);
else
break;
nBuffOffset += nNumberOfBytesRead;
- if(nNumberOfBytesRead != nNumberOfBytesToRead)
+ if (nNumberOfBytesRead != nNumberOfBytesToRead)
break;
- else
- {
+ else {
// Is there data left in the pipe?
DWORD bytesAvailable = 0;
- if (!PeekNamedPipe(handle, NULL, 0, NULL, &bytesAvailable, NULL)
- || bytesAvailable == 0)
+ if (!PeekNamedPipe(handle, NULL, 0, NULL, &bytesAvailable, NULL) || bytesAvailable == 0)
// No bytes left
break;
- }
}
+ }
CloseHandle(overlapped.hEvent);
#ifdef DEBUG_MONITOR
#ifdef READ_REPORT
@@ -190,9 +164,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
- (JNIEnv * env, jobject proc, jobject channel)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv *env, jobject proc,
+ jobject channel) {
int rc;
HANDLE handle = channelToHandle(env, channel);
#ifdef DEBUG_MONITOR
@@ -200,20 +173,19 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_clo
_stprintf(buffer, _T("Close %i\n"), fd);
OutputDebugStringW(buffer);
#endif
- rc = (CloseHandle(handle) ? 0 : -1);
+ rc = (CloseHandle(handle) ? 0 : -1);
#ifdef DEBUG_MONITOR
_stprintf(buffer, _T("Closed %i\n"), fd);
OutputDebugStringW(buffer);
#endif
- return (rc ? GetLastError() : 0);
+ return (rc ? GetLastError() : 0);
}
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_available0
- (JNIEnv * env, jobject proc, jobject channel)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_available0(JNIEnv *env, jobject proc,
+ jobject channel) {
DWORD nAvail = 0;
HANDLE handle = channelToHandle(env, channel);
@@ -227,48 +199,36 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_ava
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0
- (JNIEnv * env, jobject proc, jobject channel, jbyteArray buf, jint len)
-{
- jbyte tmpBuf[BUFF_SIZE];
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv *env, jobject proc,
+ jobject channel, jbyteArray buf, jint len) {
+ jbyte tmpBuf[BUFF_SIZE];
int nBuffOffset = 0;
HANDLE handle = channelToHandle(env, channel);
- while(len > nBuffOffset)
- {
+ while (len > nBuffOffset) {
DWORD nNumberOfBytesToWrite = min(len - nBuffOffset, BUFF_SIZE);
DWORD nNumberOfBytesWritten;
(*env)->GetByteArrayRegion(env, buf, nBuffOffset, nNumberOfBytesToWrite, tmpBuf);
- if(0 == WriteFile(handle, tmpBuf, nNumberOfBytesToWrite, &nNumberOfBytesWritten, NULL))
- {
- char * lpMsgBuf;
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (wchar_t *) &lpMsgBuf,
- 0,
- NULL
- );
+ if (0 == WriteFile(handle, tmpBuf, nNumberOfBytesToWrite, &nNumberOfBytesWritten, NULL)) {
+ char *lpMsgBuf;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
- LocalFree( lpMsgBuf );
+ LocalFree(lpMsgBuf);
return 0;
- }
- nBuffOffset += nNumberOfBytesWritten;
}
+ nBuffOffset += nNumberOfBytesWritten;
+ }
return 0;
}
#ifdef __cplusplus
extern "C"
#endif
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0
- (JNIEnv * env, jobject proc, jobject channel)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv *env, jobject proc,
+ jobject channel) {
int rc;
HANDLE handle = channelToHandle(env, channel);
#ifdef DEBUG_MONITOR
@@ -276,11 +236,11 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_cl
_stprintf(buffer, _T("Close %i\n"), fd);
OutputDebugStringW(buffer);
#endif
- FlushFileBuffers(handle);
- rc = (CloseHandle(handle) ? 0 : -1);
+ FlushFileBuffers(handle);
+ rc = (CloseHandle(handle) ? 0 : -1);
#ifdef DEBUG_MONITOR
_stprintf(buffer, _T("Closed %i\n"), fd);
OutputDebugStringW(buffer);
#endif
- return (rc ? GetLastError() : 0);
+ return (rc ? GetLastError() : 0);
}
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/pty.cpp b/core/org.eclipse.cdt.core.native/native_src/win/pty.cpp
index 36dafed9641..f1d7146b020 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/pty.cpp
+++ b/core/org.eclipse.cdt.core.native/native_src/win/pty.cpp
@@ -32,8 +32,7 @@ static std::map fd2rc;
* Method: openMaster
* Signature: (Z)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *env, jobject jobj, jboolean console)
-{
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *env, jobject jobj, jboolean console) {
jfieldID fid; /* Store the field ID */
jstring jstr = NULL;
jclass cls;
@@ -44,18 +43,18 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
line[0] = '\0';
/* Open new winpty handle */
- winpty_t* winpty = winpty_open(80, 40);
+ winpty_t *winpty = winpty_open(80, 40);
if (winpty == NULL) {
return NULL;
}
- /* Configure console mode */
- if (console) {
- winpty_set_console_mode(winpty, 1);
- }
+ /* Configure console mode */
+ if (console) {
+ winpty_set_console_mode(winpty, 1);
+ }
/* Generate masterFD based on current system time */
- srand((unsigned int)time(NULL));
+ srand((unsigned int) time(NULL));
master = rand();
/* Make sure masterFD does not exist */
@@ -64,9 +63,9 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
sprintf(line, "winpty_%i", master);
- /* Remember the winpty handle for the generated masterFD */
- fd2pty.insert(std::pair(master, winpty));
-
+ /* Remember the winpty handle for the generated masterFD */
+ fd2pty.insert(std::pair(master, winpty));
+
/* Get a reference to the obj's class */
cls = env->GetObjectClass(jobj);
@@ -75,7 +74,7 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
if (fid == NULL) {
return NULL;
}
- env->SetIntField(jobj, fid, (jint)master);
+ env->SetIntField(jobj, fid, (jint) master);
/* Create a new String for the slave. */
jstr = env->NewStringUTF(line);
@@ -88,18 +87,18 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
* Method: change_window_size
* Signature: (III)I
*/
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(JNIEnv *env, jobject jobj, jint fdm, jint width, jint height)
-{
- int fd;
- std::map :: const_iterator fd2pty_Iter;
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(JNIEnv *env, jobject jobj, jint fdm,
+ jint width, jint height) {
+ int fd;
+ std::map::const_iterator fd2pty_Iter;
- fd = fdm;
- fd2pty_Iter = fd2pty.find(fd);
- if (fd2pty_Iter != fd2pty.end()) {
- winpty_t* winpty = fd2pty_Iter -> second;
- if (winpty != NULL)
- return winpty_set_size(winpty, width, height);
- }
+ fd = fdm;
+ fd2pty_Iter = fd2pty.find(fd);
+ if (fd2pty_Iter != fd2pty.end()) {
+ winpty_t *winpty = fd2pty_Iter->second;
+ if (winpty != NULL)
+ return winpty_set_size(winpty, width, height);
+ }
return 0;
}
@@ -109,55 +108,54 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(J
* Method: read0
* Signature: (I[BI)I
*/
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0
- (JNIEnv *env, jobject jobj, jint jfd, jbyteArray buf, jint buf_len)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv *env, jobject jobj, jint jfd,
+ jbyteArray buf, jint buf_len) {
DWORD amount = -1;
OVERLAPPED over;
- int fd;
- std::map :: const_iterator fd2pty_Iter;
+ int fd;
+ std::map::const_iterator fd2pty_Iter;
- fd = jfd;
- fd2pty_Iter = fd2pty.find(fd);
- if (fd2pty_Iter != fd2pty.end()) {
- winpty_t* winpty = fd2pty_Iter -> second;
- if (winpty != NULL) {
- /* Get the pipe handle */
- HANDLE handle = winpty_get_data_pipe(winpty);
+ fd = jfd;
+ fd2pty_Iter = fd2pty.find(fd);
+ if (fd2pty_Iter != fd2pty.end()) {
+ winpty_t *winpty = fd2pty_Iter->second;
+ if (winpty != NULL) {
+ /* Get the pipe handle */
+ HANDLE handle = winpty_get_data_pipe(winpty);
- memset(&over, 0, sizeof(over));
- over.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ memset(&over, 0, sizeof(over));
+ over.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- char *buffer = new char[buf_len];
- memset(buffer, 0, sizeof(*buffer));
+ char *buffer = new char[buf_len];
+ memset(buffer, 0, sizeof(*buffer));
- jbyte *data = env->GetByteArrayElements(buf, 0);
- memset(data, 0, sizeof(*data));
+ jbyte *data = env->GetByteArrayElements(buf, 0);
+ memset(data, 0, sizeof(*data));
- amount = 0;
- BOOL ret = ReadFile(handle, buffer, buf_len, &amount, &over);
- if (!ret) {
- DWORD error = GetLastError();
- if (error == ERROR_IO_PENDING)
- ret = GetOverlappedResult(handle, &over, &amount, TRUE);
- }
+ amount = 0;
+ BOOL ret = ReadFile(handle, buffer, buf_len, &amount, &over);
+ if (!ret) {
+ DWORD error = GetLastError();
+ if (error == ERROR_IO_PENDING)
+ ret = GetOverlappedResult(handle, &over, &amount, TRUE);
+ }
- if (ret && amount > 0)
- memcpy(data, buffer, amount);
+ if (ret && amount > 0)
+ memcpy(data, buffer, amount);
- if (!ret || amount == 0)
- amount = -1;
+ if (!ret || amount == 0)
+ amount = -1;
- if (!ret && fd2pty.find(fd) != fd2pty.end()) {
- int rc = winpty_get_exit_code(winpty);
- fd2rc.insert(std::pair(fd, rc));
- }
+ if (!ret && fd2pty.find(fd) != fd2pty.end()) {
+ int rc = winpty_get_exit_code(winpty);
+ fd2rc.insert(std::pair(fd, rc));
+ }
- delete[] buffer;
- env->ReleaseByteArrayElements(buf, data, 0);
- ResetEvent(over.hEvent);
- }
- }
+ delete[] buffer;
+ env->ReleaseByteArrayElements(buf, data, 0);
+ ResetEvent(over.hEvent);
+ }
+ }
return amount;
}
@@ -167,21 +165,20 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0
* Method: close0
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint jfd)
-{
- int fd;
- std::map :: iterator fd2pty_Iter;
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint jfd) {
+ int fd;
+ std::map::iterator fd2pty_Iter;
- fd = jfd;
- fd2pty_Iter = fd2pty.find(fd);
- if (fd2pty_Iter != fd2pty.end()) {
- winpty_t* winpty = fd2pty_Iter -> second;
- fd2pty.erase(fd2pty_Iter);
- if (winpty != NULL) {
- winpty_close(winpty);
- winpty = NULL;
- }
- }
+ fd = jfd;
+ fd2pty_Iter = fd2pty.find(fd);
+ if (fd2pty_Iter != fd2pty.end()) {
+ winpty_t *winpty = fd2pty_Iter->second;
+ fd2pty.erase(fd2pty_Iter);
+ if (winpty != NULL) {
+ winpty_close(winpty);
+ winpty = NULL;
+ }
+ }
return 0;
}
@@ -191,41 +188,41 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIE
* Method: write0
* Signature: (I[BI)I
*/
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv *env, jobject jobj, jint jfd, jbyteArray buf, jint buf_len)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv *env, jobject jobj, jint jfd,
+ jbyteArray buf, jint buf_len) {
DWORD written = -1;
OVERLAPPED over;
- int fd;
- std::map :: iterator fd2pty_Iter;
+ int fd;
+ std::map::iterator fd2pty_Iter;
- fd = jfd;
- fd2pty_Iter = fd2pty.find(fd);
- if (fd2pty_Iter != fd2pty.end()) {
- winpty_t* winpty = fd2pty_Iter -> second;
- if (winpty != NULL) {
- /* Get the pipe handle */
- HANDLE handle = winpty_get_data_pipe(winpty);
-
- memset(&over, 0, sizeof(over));
- over.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ fd = jfd;
+ fd2pty_Iter = fd2pty.find(fd);
+ if (fd2pty_Iter != fd2pty.end()) {
+ winpty_t *winpty = fd2pty_Iter->second;
+ if (winpty != NULL) {
+ /* Get the pipe handle */
+ HANDLE handle = winpty_get_data_pipe(winpty);
- char *buffer = new char[buf_len];
- memset(buffer, 0, sizeof(*buffer));
+ memset(&over, 0, sizeof(over));
+ over.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- jbyte *data = env->GetByteArrayElements(buf, 0);
- memcpy(buffer, data, buf_len);
+ char *buffer = new char[buf_len];
+ memset(buffer, 0, sizeof(*buffer));
- BOOL ret = WriteFile(handle, buffer, buf_len, &written, &over);
- env->ReleaseByteArrayElements(buf, data, 0);
+ jbyte *data = env->GetByteArrayElements(buf, 0);
+ memcpy(buffer, data, buf_len);
- if (!ret && GetLastError() == ERROR_IO_PENDING)
- ret = GetOverlappedResult(handle, &over, &written, TRUE);
- if (!ret || (int)written != buf_len)
- written = -1;
+ BOOL ret = WriteFile(handle, buffer, buf_len, &written, &over);
+ env->ReleaseByteArrayElements(buf, data, 0);
- delete[] buffer;
- }
- }
+ if (!ret && GetLastError() == ERROR_IO_PENDING)
+ ret = GetOverlappedResult(handle, &over, &written, TRUE);
+ if (!ret || (int) written != buf_len)
+ written = -1;
+
+ delete[] buffer;
+ }
+ }
return written;
}
@@ -235,21 +232,20 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNI
* Method: close0
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint jfd)
-{
- int fd;
- std::map :: iterator fd2pty_Iter;
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint jfd) {
+ int fd;
+ std::map::iterator fd2pty_Iter;
- fd = jfd;
- fd2pty_Iter = fd2pty.find(fd);
- if (fd2pty_Iter != fd2pty.end()) {
- winpty_t* winpty = fd2pty_Iter -> second;
- fd2pty.erase(fd2pty_Iter);
- if (winpty != NULL) {
- winpty_close(winpty);
- winpty = NULL;
- }
- }
+ fd = jfd;
+ fd2pty_Iter = fd2pty.find(fd);
+ if (fd2pty_Iter != fd2pty.end()) {
+ winpty_t *winpty = fd2pty_Iter->second;
+ fd2pty.erase(fd2pty_Iter);
+ if (winpty != NULL) {
+ winpty_close(winpty);
+ winpty = NULL;
+ }
+ }
return 0;
}
@@ -257,57 +253,52 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNI
/*
* Convert convert slashes to backslashes.
*/
-static std::wstring convertSlashes(const wchar_t *path)
-{
- std::wstring ret;
+static std::wstring convertSlashes(const wchar_t *path) {
+ std::wstring ret;
for (int i = 0; path[i] != L'\0'; ++i) {
- if (path[i] == L'/')
- ret.push_back(L'\\');
- else
- ret.push_back(path[i]);
- }
+ if (path[i] == L'/')
+ ret.push_back(L'\\');
+ else
+ ret.push_back(path[i]);
+ }
- return ret;
+ return ret;
}
// Convert argc/argv into a Win32 command-line following the escaping convention
// documented on MSDN. (e.g. see CommandLineToArgvW documentation)
-static std::wstring argvToCommandLine(const std::vector &argv)
-{
- std::wstring result;
- for (size_t argIndex = 0; argIndex < argv.size(); ++argIndex) {
- if (argIndex > 0)
- result.push_back(L' ');
- const wchar_t *arg = argv[argIndex].c_str();
- const bool quote =
- wcschr(arg, L' ') != NULL ||
- wcschr(arg, L'\t') != NULL ||
- *arg == L'\0';
- if (quote)
- result.push_back(L'\"');
- int bsCount = 0;
- for (const wchar_t *p = arg; *p != L'\0'; ++p) {
- if (*p == L'\\') {
- bsCount++;
- } else if (*p == L'\"') {
- result.append(bsCount * 2 + 1, L'\\');
- result.push_back(L'\"');
- bsCount = 0;
- } else {
- result.append(bsCount, L'\\');
- bsCount = 0;
- result.push_back(*p);
- }
- }
- if (quote) {
- result.append(bsCount * 2, L'\\');
- result.push_back(L'\"');
- } else {
- result.append(bsCount, L'\\');
- }
- }
- return result;
+static std::wstring argvToCommandLine(const std::vector &argv) {
+ std::wstring result;
+ for (size_t argIndex = 0; argIndex < argv.size(); ++argIndex) {
+ if (argIndex > 0)
+ result.push_back(L' ');
+ const wchar_t *arg = argv[argIndex].c_str();
+ const bool quote = wcschr(arg, L' ') != NULL || wcschr(arg, L'\t') != NULL || *arg == L'\0';
+ if (quote)
+ result.push_back(L'\"');
+ int bsCount = 0;
+ for (const wchar_t *p = arg; *p != L'\0'; ++p) {
+ if (*p == L'\\') {
+ bsCount++;
+ } else if (*p == L'\"') {
+ result.append(bsCount * 2 + 1, L'\\');
+ result.push_back(L'\"');
+ bsCount = 0;
+ } else {
+ result.append(bsCount, L'\\');
+ bsCount = 0;
+ result.push_back(*p);
+ }
+ }
+ if (quote) {
+ result.append(bsCount * 2, L'\\');
+ result.push_back(L'\"');
+ } else {
+ result.append(bsCount, L'\\');
+ }
+ }
+ return result;
}
/*
@@ -315,70 +306,66 @@ static std::wstring argvToCommandLine(const std::vector &argv)
* Method: exec2
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;IZ)I
*/
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2
- (JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jobjectArray jchannels, jstring jslaveName, jint masterFD, jboolean console)
-{
- int fd;
- std::map :: iterator fd2pty_Iter;
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2(JNIEnv *env, jobject jobj, jobjectArray jcmd,
+ jobjectArray jenv, jstring jdir, jobjectArray jchannels, jstring jslaveName, jint masterFD, jboolean console) {
+ int fd;
+ std::map::iterator fd2pty_Iter;
- const wchar_t *cwdW = (const wchar_t *) env->GetStringChars(jdir, NULL);
- const char *pts_name = env->GetStringUTFChars(jslaveName, NULL);
+ const wchar_t *cwdW = (const wchar_t*) env->GetStringChars(jdir, NULL);
+ const char *pts_name = env->GetStringUTFChars(jslaveName, NULL);
int pid = -1;
int i;
- jint argc = env->GetArrayLength(jcmd);
- jint envc = env->GetArrayLength(jenv);
+ jint argc = env->GetArrayLength(jcmd);
+ jint envc = env->GetArrayLength(jenv);
- if (jchannels == NULL || env->GetArrayLength(jchannels) != 3)
- goto bail_out;
+ if (jchannels == NULL || env->GetArrayLength(jchannels) != 3)
+ goto bail_out;
- fd = masterFD;
- fd2pty_Iter = fd2pty.find(fd);
- if (fd2pty_Iter != fd2pty.end()) {
- winpty_t* winpty = fd2pty_Iter -> second;
- if (winpty != NULL) {
- std::vector argVector;
+ fd = masterFD;
+ fd2pty_Iter = fd2pty.find(fd);
+ if (fd2pty_Iter != fd2pty.end()) {
+ winpty_t *winpty = fd2pty_Iter->second;
+ if (winpty != NULL) {
+ std::vector < std::wstring > argVector;
- for (i = 0; i < argc; i++) {
- jstring j_str = (jstring) env->GetObjectArrayElement(jcmd, i);
- const wchar_t *w_str = (const wchar_t *) env->GetStringChars(j_str, NULL);
- if (i == 0) argVector.push_back(convertSlashes(w_str));
- else argVector.push_back(w_str);
- env->ReleaseStringChars(j_str, (const jchar *) w_str);
- env->DeleteLocalRef(j_str);
- }
+ for (i = 0; i < argc; i++) {
+ jstring j_str = (jstring) env->GetObjectArrayElement(jcmd, i);
+ const wchar_t *w_str = (const wchar_t*) env->GetStringChars(j_str, NULL);
+ if (i == 0)
+ argVector.push_back(convertSlashes(w_str));
+ else
+ argVector.push_back(w_str);
+ env->ReleaseStringChars(j_str, (const jchar*) w_str);
+ env->DeleteLocalRef(j_str);
+ }
- std::wstring envp;
+ std::wstring envp;
- for (i = 0; i < envc; i++) {
- jstring j_str = (jstring) env->GetObjectArrayElement(jenv, i);
- const wchar_t *w_str = (const wchar_t *) env->GetStringChars(j_str, NULL);
- envp.append(w_str);
- envp.push_back(L'\0');
- env->ReleaseStringChars(j_str, (const jchar *) w_str);
- env->DeleteLocalRef(j_str);
- }
+ for (i = 0; i < envc; i++) {
+ jstring j_str = (jstring) env->GetObjectArrayElement(jenv, i);
+ const wchar_t *w_str = (const wchar_t*) env->GetStringChars(j_str, NULL);
+ envp.append(w_str);
+ envp.push_back(L'\0');
+ env->ReleaseStringChars(j_str, (const jchar*) w_str);
+ env->DeleteLocalRef(j_str);
+ }
- std::wstring cmdLine = argvToCommandLine(argVector);
- const wchar_t *cmdLineW = cmdLine.c_str();
+ std::wstring cmdLine = argvToCommandLine(argVector);
+ const wchar_t *cmdLineW = cmdLine.c_str();
- int ret = winpty_start_process(winpty,
- NULL,
- cmdLineW,
- cwdW,
- envp.c_str());
+ int ret = winpty_start_process(winpty, NULL, cmdLineW, cwdW, envp.c_str());
- if (ret == 0) {
- // Success. Get the process id.
- pid = winpty_get_process_id(winpty);
- }
- }
- }
+ if (ret == 0) {
+ // Success. Get the process id.
+ pid = winpty_get_process_id(winpty);
+ }
+ }
+ }
-bail_out:
- env->ReleaseStringChars(jdir, (const jchar *) cwdW);
- env->ReleaseStringUTFChars(jslaveName, pts_name);
+ bail_out: env->ReleaseStringChars(jdir, (const jchar*) cwdW);
+ env->ReleaseStringUTFChars(jslaveName, pts_name);
return pid;
}
@@ -388,35 +375,34 @@ bail_out:
* Method: waitFor
* Signature: (II)I
*/
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor
- (JNIEnv *env, jobject jobj, jint masterFD, jint pid)
-{
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor(JNIEnv *env, jobject jobj, jint masterFD, jint pid) {
int status = -1;
- DWORD flags;
+ DWORD flags;
- int fd;
- std::map :: iterator fd2pty_Iter;
- std::map :: iterator fd2rc_Iter;
+ int fd;
+ std::map::iterator fd2pty_Iter;
+ std::map::iterator fd2rc_Iter;
- fd = masterFD;
- fd2pty_Iter = fd2pty.find(fd);
- if (fd2pty_Iter != fd2pty.end()) {
- winpty_t* winpty = fd2pty_Iter -> second;
- if (winpty != NULL) {
- HANDLE handle = winpty_get_data_pipe(winpty);
- BOOL success;
- do {
- success = GetHandleInformation(handle, &flags);
- if (success) Sleep(500);
- } while (success);
+ fd = masterFD;
+ fd2pty_Iter = fd2pty.find(fd);
+ if (fd2pty_Iter != fd2pty.end()) {
+ winpty_t *winpty = fd2pty_Iter->second;
+ if (winpty != NULL) {
+ HANDLE handle = winpty_get_data_pipe(winpty);
+ BOOL success;
+ do {
+ success = GetHandleInformation(handle, &flags);
+ if (success)
+ Sleep(500);
+ } while (success);
- fd2rc_Iter = fd2rc.find(fd);
- if (fd2rc_Iter != fd2rc.end()) {
- status = fd2rc_Iter -> second;
- fd2rc.erase(fd2rc_Iter);
- }
- }
- }
+ fd2rc_Iter = fd2rc.find(fd);
+ if (fd2rc_Iter != fd2rc.end()) {
+ status = fd2rc_Iter->second;
+ fd2rc.erase(fd2rc_Iter);
+ }
+ }
+ }
return status;
}
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/pty_dllmain.cpp b/core/org.eclipse.cdt.core.native/native_src/win/pty_dllmain.cpp
index a5b138c8c45..30f38ba201e 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/pty_dllmain.cpp
+++ b/core/org.eclipse.cdt.core.native/native_src/win/pty_dllmain.cpp
@@ -2,16 +2,11 @@
#include
#include
#include
-
+
#pragma comment(lib, "delayimp")
-BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
+BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
+ switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
@@ -21,51 +16,42 @@ BOOL APIENTRY DllMain( HMODULE hModule,
return TRUE;
}
-static HMODULE getCurrentModule()
-{
- HMODULE module;
- if (!GetModuleHandleEx(
- GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
- GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
- (LPCTSTR)getCurrentModule,
- &module)) {
- assert(false);
- }
- return module;
+static HMODULE getCurrentModule() {
+ HMODULE module;
+ if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+ (LPCTSTR) getCurrentModule, &module)) {
+ assert(false);
+ }
+ return module;
}
-HMODULE PTYExplicitLoadLibrary( LPCSTR pszModuleName )
-{
- if( lstrcmpiA( pszModuleName, "winpty.dll" ) == 0 )
- {
- CHAR szPath[MAX_PATH] = "";
- //_hdllInstance is the HMODULE of *this* module
- DWORD cchPath = GetModuleFileNameA(getCurrentModule(), szPath, MAX_PATH );
- while( cchPath > 0 )
- {
- switch( szPath[cchPath - 1] )
- {
- case '\\':
- case '/':
- case ':':
- break;
- default:
- --cchPath;
- continue;
- }
- break; //stop searching; found path separator
- }
- lstrcpynA( szPath + cchPath, pszModuleName, MAX_PATH - cchPath );
- return LoadLibraryA( szPath ); //call with full path to dependent DLL
- }
- return NULL;
+HMODULE PTYExplicitLoadLibrary(LPCSTR pszModuleName) {
+ if (lstrcmpiA(pszModuleName, "winpty.dll") == 0) {
+ CHAR szPath[MAX_PATH] = "";
+ //_hdllInstance is the HMODULE of *this* module
+ DWORD cchPath = GetModuleFileNameA(getCurrentModule(), szPath, MAX_PATH);
+ while (cchPath > 0) {
+ switch (szPath[cchPath - 1]) {
+ case '\\':
+ case '/':
+ case ':':
+ break;
+ default:
+ --cchPath;
+ continue;
+ }
+ break; //stop searching; found path separator
+ }
+ lstrcpynA(szPath + cchPath, pszModuleName, MAX_PATH - cchPath);
+ return LoadLibraryA(szPath); //call with full path to dependent DLL
+ }
+ return NULL;
}
-FARPROC WINAPI PTYDliNotifyHook( unsigned dliNotify, PDelayLoadInfo pdli )
-{
- if( dliNotify == dliNotePreLoadLibrary )
- return (FARPROC)PTYExplicitLoadLibrary( pdli->szDll );
- return NULL;
+FARPROC WINAPI PTYDliNotifyHook(unsigned dliNotify, PDelayLoadInfo pdli) {
+ if (dliNotify == dliNotePreLoadLibrary)
+ return (FARPROC) PTYExplicitLoadLibrary(pdli->szDll);
+ return NULL;
}
extern "C" {
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/raise.c b/core/org.eclipse.cdt.core.native/native_src/win/raise.c
index ac6b9eb449e..3bfbe173fa0 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/raise.c
+++ b/core/org.eclipse.cdt.core.native/native_src/win/raise.c
@@ -22,10 +22,8 @@
extern void JNICALL ThrowByName(JNIEnv *env, const char *name, const char *msg);
-
static HWND consoleHWND;
-
/////////////////////////////////////////////////////////////////////////////////////
// Check if window is a console of process with pid
// Arguments:
@@ -34,33 +32,31 @@ static HWND consoleHWND;
// Return : TRUE if yes
/////////////////////////////////////////////////////////////////////////////////////
static BOOL CALLBACK
-find_child_console (HWND hwnd, LPARAM arg)
-{
- DWORD thread_id;
- DWORD process_id;
- DWORD pid = arg;
+find_child_console(HWND hwnd, LPARAM arg) {
+ DWORD thread_id;
+ DWORD process_id;
+ DWORD pid = arg;
- thread_id = GetWindowThreadProcessId (hwnd, &process_id);
- if (process_id == pid)
- {
- wchar_t window_class[32];
+ thread_id = GetWindowThreadProcessId(hwnd, &process_id);
+ if (process_id == pid) {
+ wchar_t window_class[32];
- GetClassName (hwnd, window_class, sizeof (window_class));
- if (wcscmp (window_class, L"ConsoleWindowClass") == 0)
- {
- consoleHWND = hwnd;
- return FALSE;
+ GetClassName(hwnd, window_class, sizeof(window_class));
+ if (wcscmp(window_class, L"ConsoleWindowClass") == 0) {
+ consoleHWND = hwnd;
+ return FALSE;
}
- }
- /* keep looking */
- return TRUE;
+ }
+ /* keep looking */
+ return TRUE;
}
// Need to declare this Win32 prototype ourselves. _WIN32_WINNT is getting
// defined to a Windows NT value, thus we don't get this. Can't assume
// we're running on XP, anyway (or can we by now?)
#if (_WIN32_WINNT < 0x0501) || defined(_MSC_VER)
-typedef BOOL (WINAPI *DebugBreakProcessFunc)(HANDLE);
+typedef BOOL(WINAPI *DebugBreakProcessFunc)
+(HANDLE);
#endif
/////////////////////////////////////////////////////////////////////////////////////
@@ -76,28 +72,25 @@ typedef BOOL (WINAPI *DebugBreakProcessFunc)(HANDLE);
// pid - process' pid
// Return : 0 if OK or error code
/////////////////////////////////////////////////////////////////////////////////////
-int interruptProcess(int pid)
-{
+int interruptProcess(int pid) {
// See if DebugBreakProcess is available (XP and beyond)
HMODULE hmod = LoadLibrary(L"Kernel32.dll");
- if (hmod != NULL)
- {
+ if (hmod != NULL) {
BOOL success = FALSE;
FARPROC procaddr = GetProcAddress(hmod, "DebugBreakProcess");
- if (procaddr != NULL)
- {
- HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
- if (proc != NULL)
- {
- typedef BOOL WINAPI (*DebugBreakProcessFunc)(HANDLE);
- DebugBreakProcessFunc pDebugBreakProcess = (DebugBreakProcessFunc)procaddr;
- success = (*pDebugBreakProcess)(proc);
+ if (procaddr != NULL) {
+ HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD) pid);
+ if (proc != NULL) {
+ typedef BOOL WINAPI( *DebugBreakProcessFunc)
+ (HANDLE);
+ DebugBreakProcessFunc pDebugBreakProcess = (DebugBreakProcessFunc) procaddr;
+ success = (*pDebugBreakProcess)(proc);
CloseHandle(proc);
}
}
FreeLibrary(hmod);
hmod = NULL;
-
+
if (success)
return 0; // 0 == OK; if not, try old-school way
}
@@ -113,75 +106,65 @@ int interruptProcess(int pid)
OutputDebugStringW(buffer);
#endif
// Find console
- EnumWindows (find_child_console, (LPARAM) pid);
+ EnumWindows(find_child_console, (LPARAM) pid);
- if(NULL != consoleHWND) // Yes, we found out it
- {
- // We are going to switch focus to console,
- // send Ctrl-C and then restore focus
- BYTE control_scan_code = (BYTE) MapVirtualKey (VK_CONTROL, 0);
- /* Fake Ctrl-C for SIGINT, and Ctrl-Break for SIGQUIT. */
- BYTE vk_c_code = 'C';
- BYTE vk_break_code = VK_CANCEL;
- BYTE c_scan_code = (BYTE) MapVirtualKey (vk_c_code, 0);
- BYTE break_scan_code = (BYTE) MapVirtualKey (vk_break_code, 0);
- HWND foreground_window;
-
+ if (NULL != consoleHWND) // Yes, we found out it
+ {
+ // We are going to switch focus to console,
+ // send Ctrl-C and then restore focus
+ BYTE control_scan_code = (BYTE) MapVirtualKey(VK_CONTROL, 0);
+ /* Fake Ctrl-C for SIGINT, and Ctrl-Break for SIGQUIT. */
+ BYTE vk_c_code = 'C';
+ BYTE vk_break_code = VK_CANCEL;
+ BYTE c_scan_code = (BYTE) MapVirtualKey(vk_c_code, 0);
+ BYTE break_scan_code = (BYTE) MapVirtualKey(vk_break_code, 0);
+ HWND foreground_window;
- foreground_window = GetForegroundWindow ();
- if (foreground_window)
- {
- /* NT 5.0, and apparently also Windows 98, will not allow
- a Window to be set to foreground directly without the
- user's involvement. The workaround is to attach
- ourselves to the thread that owns the foreground
- window, since that is the only thread that can set the
- foreground window. */
- DWORD foreground_thread, child_thread;
- foreground_thread =
- GetWindowThreadProcessId (foreground_window, NULL);
- if (foreground_thread == GetCurrentThreadId ()
- || !AttachThreadInput (GetCurrentThreadId (),
- foreground_thread, TRUE))
- foreground_thread = 0;
+ foreground_window = GetForegroundWindow();
+ if (foreground_window) {
+ /* NT 5.0, and apparently also Windows 98, will not allow
+ a Window to be set to foreground directly without the
+ user's involvement. The workaround is to attach
+ ourselves to the thread that owns the foreground
+ window, since that is the only thread that can set the
+ foreground window. */
+ DWORD foreground_thread, child_thread;
+ foreground_thread = GetWindowThreadProcessId(foreground_window, NULL);
+ if (foreground_thread == GetCurrentThreadId()
+ || !AttachThreadInput(GetCurrentThreadId(), foreground_thread, TRUE))
+ foreground_thread = 0;
- child_thread = GetWindowThreadProcessId (consoleHWND, NULL);
- if (child_thread == GetCurrentThreadId ()
- || !AttachThreadInput (GetCurrentThreadId (),
- child_thread, TRUE))
- child_thread = 0;
+ child_thread = GetWindowThreadProcessId(consoleHWND, NULL);
+ if (child_thread == GetCurrentThreadId() || !AttachThreadInput(GetCurrentThreadId(), child_thread, TRUE))
+ child_thread = 0;
- /* Set the foreground window to the child. */
- if (SetForegroundWindow (consoleHWND))
- {
- if(0 != break_scan_code) {
- /* Generate keystrokes as if user had typed Ctrl-Break */
- keybd_event (VK_CONTROL, control_scan_code, 0, 0);
- keybd_event (vk_break_code, break_scan_code, KEYEVENTF_EXTENDEDKEY, 0);
- keybd_event (vk_break_code, break_scan_code,
- KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
- keybd_event (VK_CONTROL, control_scan_code, KEYEVENTF_KEYUP, 0);
- }
+ /* Set the foreground window to the child. */
+ if (SetForegroundWindow(consoleHWND)) {
+ if (0 != break_scan_code) {
+ /* Generate keystrokes as if user had typed Ctrl-Break */
+ keybd_event(VK_CONTROL, control_scan_code, 0, 0);
+ keybd_event(vk_break_code, break_scan_code, KEYEVENTF_EXTENDEDKEY, 0);
+ keybd_event(vk_break_code, break_scan_code, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
+ keybd_event(VK_CONTROL, control_scan_code, KEYEVENTF_KEYUP, 0);
+ }
- /* Sleep for a bit to give time for respond */
- Sleep (100);
+ /* Sleep for a bit to give time for respond */
+ Sleep(100);
- SetForegroundWindow (foreground_window);
- }
- /* Detach from the foreground and child threads now that
- the foreground switching is over. */
- if (foreground_thread)
- AttachThreadInput (GetCurrentThreadId (),
- foreground_thread, FALSE);
- if (child_thread)
- AttachThreadInput (GetCurrentThreadId (),
- child_thread, FALSE);
+ SetForegroundWindow(foreground_window);
+ }
+ /* Detach from the foreground and child threads now that
+ the foreground switching is over. */
+ if (foreground_thread)
+ AttachThreadInput(GetCurrentThreadId(), foreground_thread, FALSE);
+ if (child_thread)
+ AttachThreadInput(GetCurrentThreadId(), child_thread, FALSE);
#ifdef DEBUG_MONITOR
_stprintf(buffer, _T("Sent Ctrl-C & Ctrl-Break to process %i\n"), pid);
OutputDebugStringW(buffer);
#endif
- }
- }
+ }
+ }
#ifdef DEBUG_MONITOR
else {
_stprintf(buffer, _T("Cannot find console for process %i\n"), pid);
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/spawner.c b/core/org.eclipse.cdt.core.native/native_src/win/spawner.c
index f82e913af67..1c82076faf3 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/spawner.c
+++ b/core/org.eclipse.cdt.core.native/native_src/win/spawner.c
@@ -23,38 +23,31 @@
CRITICAL_SECTION cs;
-
-wchar_t path[MAX_PATH + 1] = {_T('\0') }; // Directory where spawner.dll is located
+wchar_t path[MAX_PATH + 1] = { _T('\0') }; // Directory where spawner.dll is located
#if __cplusplus
extern "C"
#endif
-BOOL APIENTRY DllMain( HINSTANCE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- {
- wchar_t * p;
- InitializeCriticalSection(&cs);
- GetModuleFileNameW(hModule, path, MAX_PATH);
- p = wcsrchr(path, _T('\\'));
- if(NULL != p)
- *(p + 1) = _T('\0');
- else
- wcscat(path, L"\\");
- }
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- DeleteCriticalSection(&cs);
- break;
- }
- return TRUE;
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
+ switch (ul_reason_for_call) {
+ case DLL_PROCESS_ATTACH: {
+ wchar_t *p;
+ InitializeCriticalSection(&cs);
+ GetModuleFileNameW(hModule, path, MAX_PATH);
+ p = wcsrchr(path, _T('\\'));
+ if (NULL != p)
+ *(p + 1) = _T('\0');
+ else
+ wcscat(path, L"\\");
+ }
+ break;
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ DeleteCriticalSection(&cs);
+ break;
+ }
+ return TRUE;
}
diff --git a/core/org.eclipse.cdt.core.native/native_src/win/starter.c b/core/org.eclipse.cdt.core.native/native_src/win/starter.c
index 6284f75586f..4309c6061bb 100644
--- a/core/org.eclipse.cdt.core.native/native_src/win/starter.c
+++ b/core/org.eclipse.cdt.core.native/native_src/win/starter.c
@@ -30,32 +30,30 @@
#define MAX_CMD_LINE_LENGTH (2049)
#define PIPE_NAME_LENGTH 100
-int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
- int availSpace);
+int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace);
void DisplayErrorMessage();
//BOOL KillProcessEx(DWORD dwProcessId); // Handle of the process
///////////////////////////////////////////////////////////////////////////////
-BOOL WINAPI HandlerRoutine( DWORD dwCtrlType) // control signal type
+BOOL WINAPI HandlerRoutine(DWORD dwCtrlType) // control signal type
{
BOOL ret = TRUE;
- switch(dwCtrlType)
- {
- case CTRL_C_EVENT:
+ switch (dwCtrlType) {
+ case CTRL_C_EVENT:
break;
- case CTRL_BREAK_EVENT:
+ case CTRL_BREAK_EVENT:
break;
- case CTRL_CLOSE_EVENT:
+ case CTRL_CLOSE_EVENT:
ret = FALSE;
break;
- case CTRL_LOGOFF_EVENT:
+ case CTRL_LOGOFF_EVENT:
ret = FALSE;
break;
- case CTRL_SHUTDOWN_EVENT:
+ case CTRL_SHUTDOWN_EVENT:
ret = FALSE;
break;
- default:
+ default:
break;
}
return ret;
@@ -63,24 +61,24 @@ BOOL WINAPI HandlerRoutine( DWORD dwCtrlType) // control signal type
// The default here means we haven't checked yet
// i.e. cygwin is true but the bin dir hasn't been captured
-wchar_t * cygwinBin = NULL;
+wchar_t *cygwinBin = NULL;
bool _isCygwin = true;
bool isCygwin(HANDLE process) {
// Have we checked before?
if (cygwinBin != NULL || !_isCygwin)
return _isCygwin;
-
+
// See if this process loaded cygwin, need a different SIGINT for them
HMODULE mods[1024];
DWORD needed;
if (EnumProcessModules(process, mods, sizeof(mods), &needed)) {
int i;
needed /= sizeof(HMODULE);
- for (i = 0; i < needed; ++i ) {
+ for (i = 0; i < needed; ++i) {
wchar_t modName[MAX_PATH];
if (GetModuleFileNameEx(process, mods[i], modName, MAX_PATH)) {
- wchar_t * p = wcsrchr(modName, L'\\');
+ wchar_t *p = wcsrchr(modName, L'\\');
if (p) {
*p = 0; // Null terminate there for future reference
if (!wcscmp(++p, L"cygwin1.dll")) {
@@ -93,15 +91,15 @@ bool isCygwin(HANDLE process) {
}
}
}
-
+
_isCygwin = false;
return _isCygwin;
}
-bool runCygwinCommand(wchar_t * command) {
+bool runCygwinCommand(wchar_t *command) {
wchar_t cygcmd[1024];
- swprintf(cygcmd, sizeof(cygcmd)/sizeof(cygcmd[0]), L"%s\\%s", cygwinBin, command);
-
+ swprintf(cygcmd, sizeof(cygcmd) / sizeof(cygcmd[0]), L"%s\\%s", cygwinBin, command);
+
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
@@ -121,18 +119,18 @@ bool runCygwinCommand(wchar_t * command) {
return false;
}
-void ensureSize(wchar_t** ptr, int* psize, int requiredLength) {
- int size= *psize;
+void ensureSize(wchar_t **ptr, int *psize, int requiredLength) {
+ int size = *psize;
if (requiredLength > size) {
- size= 2*size;
+ size = 2 * size;
if (size < requiredLength) {
- size= requiredLength;
+ size = requiredLength;
}
- *ptr= (wchar_t *)realloc(*ptr, size * sizeof(wchar_t));
+ *ptr = (wchar_t*) realloc(*ptr, size * sizeof(wchar_t));
if (NULL == *ptr) {
- *psize= 0;
+ *psize = 0;
} else {
- *psize= size;
+ *psize = size;
}
}
}
@@ -140,27 +138,25 @@ void ensureSize(wchar_t** ptr, int* psize, int requiredLength) {
int main() {
int argc;
- wchar_t ** argv = CommandLineToArgvW(GetCommandLine(), &argc);
+ wchar_t **argv = CommandLineToArgvW(GetCommandLine(), &argc);
// Make sure that we've been passed the right number of arguments
if (argc < 8) {
- _tprintf(_T("Usage: %s (four inheritable event handles) (CommandLineToSpawn)\n"),
- argv[0]);
- return(0);
+ _tprintf(_T("Usage: %s (four inheritable event handles) (CommandLineToSpawn)\n"), argv[0]);
+ return (0);
}
// Construct the full command line
- int nCmdLineLength= MAX_CMD_LINE_LENGTH;
- wchar_t * szCmdLine= (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
- szCmdLine[0]= 0;
+ int nCmdLineLength = MAX_CMD_LINE_LENGTH;
+ wchar_t *szCmdLine = (wchar_t*) malloc(nCmdLineLength * sizeof(wchar_t));
+ szCmdLine[0] = 0;
int nPos = 0;
- for(int i = 8; i < argc; ++i)
- {
+ for (int i = 8; i < argc; ++i) {
int nCpyLen;
- int len= wcslen(argv[i]);
- int requiredSize= nPos+len+2;
- if (requiredSize > 32*1024) {
+ int len = wcslen(argv[i]);
+ int requiredSize = nPos + len + 2;
+ if (requiredSize > 32 * 1024) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Command line too long!\n"));
#endif
@@ -173,8 +169,7 @@ int main() {
#endif
return 0;
}
- if(0 > (nCpyLen = copyTo(szCmdLine + nPos, argv[i], len, nCmdLineLength - nPos)))
- {
+ if (0 > (nCpyLen = copyTo(szCmdLine + nPos, argv[i], len, nCmdLineLength - nPos))) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Not enough space to build command line\n"));
#endif
@@ -186,8 +181,8 @@ int main() {
}
szCmdLine[nPos] = _T('\0');
- STARTUPINFOW si = {sizeof(si)};
- PROCESS_INFORMATION pi = {0};
+ STARTUPINFOW si = { sizeof(si) };
+ PROCESS_INFORMATION pi = { 0 };
DWORD dwExitCode = 0;
#ifdef DEBUG_MONITOR
int currentPID = GetCurrentProcessId();
@@ -202,7 +197,7 @@ int main() {
h[2] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[5]); // simulated SIGTERM
h[3] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[6]); // simulated SIGKILL
h[4] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[7]); // CTRL-C, in all cases
-
+
SetConsoleCtrlHandler(HandlerRoutine, TRUE);
int parentPid = wcstol(argv[1], NULL, 10);
@@ -211,9 +206,12 @@ int main() {
wchar_t outPipeName[PIPE_NAME_LENGTH];
wchar_t errPipeName[PIPE_NAME_LENGTH];
- swprintf(inPipeName, sizeof(inPipeName)/sizeof(inPipeName[0]), L"\\\\.\\pipe\\stdin%08i%010i", parentPid, nCounter);
- swprintf(outPipeName, sizeof(outPipeName)/sizeof(outPipeName[0]), L"\\\\.\\pipe\\stdout%08i%010i", parentPid, nCounter);
- swprintf(errPipeName, sizeof(errPipeName)/sizeof(errPipeName[0]), L"\\\\.\\pipe\\stderr%08i%010i", parentPid, nCounter);
+ swprintf(inPipeName, sizeof(inPipeName) / sizeof(inPipeName[0]), L"\\\\.\\pipe\\stdin%08i%010i", parentPid,
+ nCounter);
+ swprintf(outPipeName, sizeof(outPipeName) / sizeof(outPipeName[0]), L"\\\\.\\pipe\\stdout%08i%010i", parentPid,
+ nCounter);
+ swprintf(errPipeName, sizeof(errPipeName) / sizeof(errPipeName[0]), L"\\\\.\\pipe\\stderr%08i%010i", parentPid,
+ nCounter);
#ifdef DEBUG_MONITOR
swprintf(buffer, _T("Pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
OutputDebugStringW(buffer);
@@ -226,10 +224,14 @@ int main() {
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
- if((INVALID_HANDLE_VALUE == (stdHandles[0] = CreateFileW(inPipeName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, &sa))) ||
- (INVALID_HANDLE_VALUE == (stdHandles[1] = CreateFileW(outPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))) ||
- (INVALID_HANDLE_VALUE == (stdHandles[2] = CreateFileW(errPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))))
- {
+ if ((INVALID_HANDLE_VALUE
+ == (stdHandles[0] = CreateFileW(inPipeName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, &sa)))
+ || (INVALID_HANDLE_VALUE
+ == (stdHandles[1] = CreateFileW(outPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
+ 0, &sa)))
+ || (INVALID_HANDLE_VALUE
+ == (stdHandles[2] = CreateFileW(errPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
+ 0, &sa)))) {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Failed to open pipe %i, %i, %i: %i\n"), stdHandles[0], stdHandles[1], stdHandles[2], GetLastError());
OutputDebugStringW(buffer);
@@ -243,9 +245,8 @@ int main() {
SetHandleInformation(stdHandles[1], HANDLE_FLAG_INHERIT, TRUE);
SetHandleInformation(stdHandles[2], HANDLE_FLAG_INHERIT, TRUE);
- if(!SetStdHandle(STD_INPUT_HANDLE, stdHandles[0]) ||
- !SetStdHandle(STD_OUTPUT_HANDLE, stdHandles[1]) ||
- !SetStdHandle(STD_ERROR_HANDLE, stdHandles[2])) {
+ if (!SetStdHandle(STD_INPUT_HANDLE, stdHandles[0]) || !SetStdHandle(STD_OUTPUT_HANDLE, stdHandles[1])
+ || !SetStdHandle(STD_ERROR_HANDLE, stdHandles[2])) {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Failed to reassign standard streams: %i\n"), GetLastError());
OutputDebugStringW(buffer);
@@ -282,18 +283,18 @@ int main() {
// Create job object
HANDLE hJob = CreateJobObject(NULL, NULL);
if (hJob != NULL) {
- // Configure job to
- // - terminate all associated processes when the last handle to it is closed
- // - allow child processes to break away from the job.
- JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo;
- ZeroMemory(&jobInfo, sizeof(jobInfo));
- jobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_BREAKAWAY_OK;
- if (!SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &jobInfo, sizeof(jobInfo))) {
+ // Configure job to
+ // - terminate all associated processes when the last handle to it is closed
+ // - allow child processes to break away from the job.
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobInfo;
+ ZeroMemory(&jobInfo, sizeof(jobInfo));
+ jobInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_BREAKAWAY_OK;
+ if (!SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &jobInfo, sizeof(jobInfo))) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Cannot set job information\n"));
DisplayErrorMessage();
#endif
- }
+ }
} else {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Cannot create job object\n"));
@@ -304,18 +305,16 @@ int main() {
// If this process is already part of a job, the flag CREATE_BREAKAWAY_FROM_JOB
// makes the child process detach from the job, such that we can assign it
// to our own job object.
- BOOL f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE,
- CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi);
+ BOOL f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi);
// If breaking away from job is not permitted, retry without breakaway flag
- if (!f)
- f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE,
- 0, NULL, NULL, &si, &pi);
+ if (!f)
+ f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
// We don't need them any more
CloseHandle(stdHandles[0]);
CloseHandle(stdHandles[1]);
CloseHandle(stdHandles[2]);
-
+
if (f) {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Process %i started\n"), pi.dwProcessId);
@@ -325,8 +324,8 @@ int main() {
CloseHandle(pi.hThread);
h[1] = pi.hProcess;
- if(NULL != hJob) {
- if(!AssignProcessToJobObject(hJob, pi.hProcess)) {
+ if (NULL != hJob) {
+ if (!AssignProcessToJobObject(hJob, pi.hProcess)) {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Cannot assign process %i to a job\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
@@ -335,13 +334,11 @@ int main() {
}
}
- while(!exitProc)
- {
+ while (!exitProc) {
// Wait for the spawned-process to die or for the event
// indicating that the processes should be forcibly killed.
DWORD event = WaitForMultipleObjects(5, h, FALSE, INFINITE);
- switch (event)
- {
+ switch (event) {
case WAIT_OBJECT_0 + 0: // SIGINT
case WAIT_OBJECT_0 + 4: // CTRL-C
#ifdef DEBUG_MONITOR
@@ -351,7 +348,7 @@ int main() {
if ((event == (WAIT_OBJECT_0 + 0)) && isCygwin(h[1])) {
// Need to issue a kill command
wchar_t kill[1024];
- swprintf(kill, sizeof(kill)/sizeof(kill[0]), L"kill -SIGINT %d", pi.dwProcessId);
+ swprintf(kill, sizeof(kill) / sizeof(kill[0]), L"kill -SIGINT %d", pi.dwProcessId);
if (!runCygwinCommand(kill)) {
// fall back to console event
GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
@@ -374,14 +371,14 @@ int main() {
exitProc = TRUE;
break;
- // Terminate and Kill behavior differ only for cygwin processes, where
- // we use the cygwin 'kill' command. We send a SIGKILL in one case,
- // SIGTERM in the other. For non-cygwin processes, both requests
- // are treated exactly the same
+ // Terminate and Kill behavior differ only for cygwin processes, where
+ // we use the cygwin 'kill' command. We send a SIGKILL in one case,
+ // SIGTERM in the other. For non-cygwin processes, both requests
+ // are treated exactly the same
case WAIT_OBJECT_0 + 2: // TERM
case WAIT_OBJECT_0 + 3: // KILL
{
- const wchar_t* signal = (event == WAIT_OBJECT_0 + 2) ? L"TERM" : L"KILL";
+ const wchar_t *signal = (event == WAIT_OBJECT_0 + 2) ? L"TERM" : L"KILL";
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("starter received %s event (PID %i)\n"), signal, currentPID);
OutputDebugStringW(buffer);
@@ -389,19 +386,19 @@ int main() {
if (isCygwin(h[1])) {
// Need to issue a kill command
wchar_t kill[1024];
- swprintf(kill, sizeof(kill)/sizeof(kill[0]), L"kill -%s %d", signal, pi.dwProcessId);
+ swprintf(kill, sizeof(kill) / sizeof(kill[0]), L"kill -%s %d", signal, pi.dwProcessId);
if (!runCygwinCommand(kill)) {
// fall back to console event
GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
}
- } else {
+ } else {
GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
}
-
+
SetEvent(waitEvent);
-
- if(NULL != hJob) {
- if(!TerminateJobObject(hJob, (DWORD)-1)) {
+
+ if (NULL != hJob) {
+ if (!TerminateJobObject(hJob, (DWORD) - 1)) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Cannot terminate job\n"));
DisplayErrorMessage();
@@ -432,8 +429,7 @@ int main() {
#endif
}
- if (NULL != szCmdLine)
- {
+ if (NULL != szCmdLine) {
free(szCmdLine);
}
@@ -444,7 +440,7 @@ int main() {
CloseHandle(h[3]);
CloseHandle(h[4]);
- return(dwExitCode);
+ return (dwExitCode);
}
/////////////////////////////////////////////////////////////////////////////////////
@@ -456,8 +452,7 @@ int main() {
// availSpace - size of the target buffer
// Return :number of bytes used in target, or -1 in case of error
/////////////////////////////////////////////////////////////////////////////////////
-int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
- int availSpace) {
+int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace) {
BOOL bSlash = FALSE;
int i = 0, j = 0;
int totCpyLength = cpyLength;
@@ -473,7 +468,7 @@ int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
if ((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1))) {
// Already done
nQuotationMode = QUOTATION_DONE;
- } else if (wcschr(source, _T(' '))== NULL) {
+ } else if (wcschr(source, _T(' ')) == NULL) {
// No reason to quotate term becase it doesn't have embedded spaces
nQuotationMode = QUOTATION_NONE;
} else {
@@ -488,7 +483,7 @@ int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
bSlash = TRUE;
else
// Don't escape embracing quotation marks
- if ((source[i] == _T('\"')) && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))) )) {
+ if ((source[i] == _T('\"')) && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))))) {
if (!bSlash) {
if (j == availSpace)
return -1;
@@ -514,11 +509,10 @@ int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
}
void DisplayErrorMessage() {
- wchar_t * lpMsgBuf;
- FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (wchar_t *) &lpMsgBuf, 0, NULL);
+ wchar_t *lpMsgBuf;
+ FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
+ GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (wchar_t*) &lpMsgBuf, 0, NULL);
OutputDebugStringW(lpMsgBuf);
// Free the buffer.
LocalFree(lpMsgBuf);
diff --git a/core/org.eclipse.cdt.core.native/pom.xml b/core/org.eclipse.cdt.core.native/pom.xml
index 4b170b71c4d..0bee5d6e28a 100644
--- a/core/org.eclipse.cdt.core.native/pom.xml
+++ b/core/org.eclipse.cdt.core.native/pom.xml
@@ -23,7 +23,7 @@
../../pom.xml
- 6.0.0-SNAPSHOT
+ 6.0.100-SNAPSHOT
org.eclipse.cdt.core.native
eclipse-plugin
diff --git a/core/org.eclipse.cdt.core.tests/.settings/org.eclipse.cdt.core.prefs b/core/org.eclipse.cdt.core.tests/.settings/org.eclipse.cdt.core.prefs
index 086daaa547e..dc54ff754d8 100644
--- a/core/org.eclipse.cdt.core.tests/.settings/org.eclipse.cdt.core.prefs
+++ b/core/org.eclipse.cdt.core.tests/.settings/org.eclipse.cdt.core.prefs
@@ -1,5 +1,192 @@
-#Wed Jun 06 11:37:01 EDT 2007
eclipse.preferences.version=1
indexer/indexerId=org.eclipse.cdt.core.nullindexer
indexerId=org.eclipse.cdt.core.nullindexer
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.cdt.core.formatter.alignment_for_assignment=16
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
+org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
+org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
+org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
+org.eclipse.cdt.core.formatter.alignment_for_member_access=0
+org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
+org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
+org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
+org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
+org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
+org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
+org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
+org.eclipse.cdt.core.formatter.compact_else_if=true
+org.eclipse.cdt.core.formatter.continuation_indentation=2
+org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.cdt.core.formatter.format_block_comment=true
+org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.cdt.core.formatter.format_header_comment=true
+org.eclipse.cdt.core.formatter.format_line_comment=true
+org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
+org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
+org.eclipse.cdt.core.formatter.indent_empty_lines=false
+org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.cdt.core.formatter.indentation.size=4
+org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.join_wrapped_lines=true
+org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.lineSplit=120
+org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.cdt.core.formatter.tabulation.char=tab
+org.eclipse.cdt.core.formatter.tabulation.size=4
+org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
+org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/core/org.eclipse.cdt.core.tests/.settings/org.eclipse.cdt.ui.prefs b/core/org.eclipse.cdt.core.tests/.settings/org.eclipse.cdt.ui.prefs
new file mode 100644
index 00000000000..4f7bce2bbb8
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/.settings/org.eclipse.cdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_Unmanaged profile 'CDT'
+formatter_settings_version=1
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.win32.x86_64/META-INF/MANIFEST.MF
index 8529f94bd49..bc0e7885833 100644
--- a/core/org.eclipse.cdt.core.win32.x86_64/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core.win32.x86_64/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.win32.x86_64
Bundle-SymbolicName: org.eclipse.cdt.core.win32.x86_64;singleton:=true
-Bundle-Version: 6.0.0.qualifier
+Bundle-Version: 6.0.100.qualifier
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Eclipse-PlatformFilter: (&(osgi.os=win32)(osgi.arch=x86_64))
Bundle-Vendor: %providerName
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll
index fac7dd35856..80d1046de90 100755
Binary files a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll and b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll differ
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll
index 37330e87ec6..59eb5d0d246 100755
Binary files a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll and b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll differ
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe
index 5b7c05cc415..2615eeb1d3d 100755
Binary files a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe and b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe differ
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/pom.xml b/core/org.eclipse.cdt.core.win32.x86_64/pom.xml
index 34b3d634385..a01e5ac505f 100644
--- a/core/org.eclipse.cdt.core.win32.x86_64/pom.xml
+++ b/core/org.eclipse.cdt.core.win32.x86_64/pom.xml
@@ -11,7 +11,7 @@
../../pom.xml
- 6.0.0-SNAPSHOT
+ 6.0.100-SNAPSHOT
org.eclipse.cdt.core.win32.x86_64
eclipse-plugin
diff --git a/core/org.eclipse.cdt.core/.project b/core/org.eclipse.cdt.core/.project
index a7aa6e98d34..03327597ad6 100644
--- a/core/org.eclipse.cdt.core/.project
+++ b/core/org.eclipse.cdt.core/.project
@@ -35,5 +35,6 @@
org.eclipse.jdt.core.javanature
org.eclipse.pde.PluginNature
org.eclipse.pde.api.tools.apiAnalysisNature
+ org.eclipse.cdt.core.cnature
diff --git a/core/org.eclipse.cdt.core/.settings/org.eclipse.cdt.core.prefs b/core/org.eclipse.cdt.core/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 00000000000..85b6db296e7
--- /dev/null
+++ b/core/org.eclipse.cdt.core/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,189 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.cdt.core.formatter.alignment_for_assignment=16
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
+org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
+org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
+org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
+org.eclipse.cdt.core.formatter.alignment_for_member_access=0
+org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
+org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
+org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
+org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
+org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
+org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
+org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
+org.eclipse.cdt.core.formatter.compact_else_if=true
+org.eclipse.cdt.core.formatter.continuation_indentation=2
+org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.cdt.core.formatter.format_block_comment=true
+org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.cdt.core.formatter.format_header_comment=true
+org.eclipse.cdt.core.formatter.format_line_comment=true
+org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
+org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
+org.eclipse.cdt.core.formatter.indent_empty_lines=false
+org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.cdt.core.formatter.indentation.size=4
+org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.join_wrapped_lines=true
+org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.lineSplit=120
+org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.cdt.core.formatter.tabulation.char=tab
+org.eclipse.cdt.core.formatter.tabulation.size=4
+org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
+org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/core/org.eclipse.cdt.core/.settings/org.eclipse.cdt.ui.prefs b/core/org.eclipse.cdt.core/.settings/org.eclipse.cdt.ui.prefs
new file mode 100644
index 00000000000..4f7bce2bbb8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/.settings/org.eclipse.cdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_Unmanaged profile 'CDT'
+formatter_settings_version=1
diff --git a/native/org.eclipse.cdt.native.serial/.project b/native/org.eclipse.cdt.native.serial/.project
index f083d6b8805..fefe4496add 100644
--- a/native/org.eclipse.cdt.native.serial/.project
+++ b/native/org.eclipse.cdt.native.serial/.project
@@ -30,5 +30,6 @@
org.eclipse.pde.PluginNature
org.eclipse.jdt.core.javanature
org.eclipse.pde.api.tools.apiAnalysisNature
+ org.eclipse.cdt.core.cnature
diff --git a/native/org.eclipse.cdt.native.serial/.settings/org.eclipse.cdt.core.prefs b/native/org.eclipse.cdt.native.serial/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 00000000000..85b6db296e7
--- /dev/null
+++ b/native/org.eclipse.cdt.native.serial/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,189 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.cdt.core.formatter.alignment_for_assignment=16
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
+org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
+org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
+org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
+org.eclipse.cdt.core.formatter.alignment_for_member_access=0
+org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
+org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
+org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
+org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
+org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
+org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
+org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
+org.eclipse.cdt.core.formatter.compact_else_if=true
+org.eclipse.cdt.core.formatter.continuation_indentation=2
+org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.cdt.core.formatter.format_block_comment=true
+org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.cdt.core.formatter.format_header_comment=true
+org.eclipse.cdt.core.formatter.format_line_comment=true
+org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
+org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
+org.eclipse.cdt.core.formatter.indent_empty_lines=false
+org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.cdt.core.formatter.indentation.size=4
+org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.join_wrapped_lines=true
+org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.lineSplit=120
+org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.cdt.core.formatter.tabulation.char=tab
+org.eclipse.cdt.core.formatter.tabulation.size=4
+org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
+org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/native/org.eclipse.cdt.native.serial/.settings/org.eclipse.cdt.ui.prefs b/native/org.eclipse.cdt.native.serial/.settings/org.eclipse.cdt.ui.prefs
new file mode 100644
index 00000000000..4f7bce2bbb8
--- /dev/null
+++ b/native/org.eclipse.cdt.native.serial/.settings/org.eclipse.cdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_Unmanaged profile 'CDT'
+formatter_settings_version=1
diff --git a/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF b/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
index 0b71926c558..2c90f7276a3 100644
--- a/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
+++ b/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.native.serial
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.100.qualifier
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.cdt.serial
diff --git a/native/org.eclipse.cdt.native.serial/native_src/serial.c b/native/org.eclipse.cdt.native.serial/native_src/serial.c
index 37a2fbc1e04..b38106e770a 100644
--- a/native/org.eclipse.cdt.native.serial/native_src/serial.c
+++ b/native/org.eclipse.cdt.native.serial/native_src/serial.c
@@ -50,7 +50,7 @@ static void closeAndthrowIOException(int fd, JNIEnv *env, const char *msg)
#else
static void closeAndthrowIOException(HANDLE handle, JNIEnv *env, const char *msg)
#endif
-{
+ {
char buff[256];
#ifndef __MINGW32__
sprintf(buff, "%s: %s", msg, strerror(errno));
@@ -63,8 +63,7 @@ static void closeAndthrowIOException(HANDLE handle, JNIEnv *env, const char *msg
(*env)->ThrowNew(env, cls, buff);
}
-static void throwIOException(JNIEnv *env, const char *msg)
-{
+static void throwIOException(JNIEnv *env, const char *msg) {
char buff[256];
#ifndef __MINGW32__
sprintf(buff, "%s: %s", msg, strerror(errno));
@@ -75,10 +74,10 @@ static void throwIOException(JNIEnv *env, const char *msg)
(*env)->ThrowNew(env, cls, buff);
}
-JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName, jint baudRate, jint byteSize, jint parity, jint stopBits)
-{
+JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName, jint baudRate, jint byteSize,
+ jint parity, jint stopBits) {
#ifndef __MINGW32__
- const char * cportName = (*env)->GetStringUTFChars(env, portName, NULL);
+ const char *cportName = (*env)->GetStringUTFChars(env, portName, NULL);
int fd = open(cportName, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd < 0) {
char msg[256];
@@ -255,12 +254,12 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
// ignore parity
options.c_iflag |= IGNPAR;
-
+
// turn off those bits in the input flag that fiddle with CR and NL
options.c_iflag &= ~(ICRNL | INLCR | IGNCR);
- options.c_cc[VMIN] = 0; // min chars to read
- options.c_cc[VTIME] = 2; // 10ths second timeout
+ options.c_cc[VMIN] = 0; // min chars to read
+ options.c_cc[VTIME] = 2; // 10ths second timeout
tcflush(fd, TCIFLUSH);
tcsetattr(fd, TCSANOW, &options);
@@ -342,7 +341,8 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
#endif // __MINGW32__
}
-JNIEXPORT void JNICALL FUNC(close0)(JNIEnv *env, jobject jobj, jlong handle)
+JNIEXPORT void JNICALL FUNC(close0)
+(JNIEnv *env, jobject jobj, jlong handle)
{
#ifndef __MINGW32__
close(handle);
@@ -355,11 +355,10 @@ JNIEXPORT void JNICALL FUNC(close0)(JNIEnv *env, jobject jobj, jlong handle)
#endif
}
-JNIEXPORT jint JNICALL FUNC(available0)(JNIEnv * env, jobject jobj, jlong jhandle)
-{
+JNIEXPORT jint JNICALL FUNC(available0)(JNIEnv *env, jobject jobj, jlong jhandle) {
#ifndef __MINGW32__
int result = 0;
- if (ioctl(jhandle, FIONREAD, &result ) < 0) {
+ if (ioctl(jhandle, FIONREAD, &result) < 0) {
throwIOException(env, "Error calling ioctl");
return 0;
}
@@ -381,8 +380,7 @@ JNIEXPORT jint JNICALL FUNC(available0)(JNIEnv * env, jobject jobj, jlong jhandl
#endif
}
-JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv * env, jobject jobj, jlong jhandle, jbyteArray bytes, jint offset, jint size)
-{
+JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv *env, jobject jobj, jlong jhandle, jbyteArray bytes, jint offset, jint size) {
#ifndef __MINGW32__
jbyte buff[256];
int n = size < sizeof(buff) ? size : sizeof(buff);
@@ -436,7 +434,8 @@ JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv * env, jobject jobj, jlong jhandle, jb
#endif
}
-JNIEXPORT void JNICALL FUNC(write0)(JNIEnv *env, jobject jobj, jlong jhandle, jint b)
+JNIEXPORT void JNICALL FUNC(write0)
+(JNIEnv *env, jobject jobj, jlong jhandle, jint b)
{
#ifndef __MINGW32__
char buff = b;
diff --git a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
index 8383c853b8a..0e6f6a68212 100755
Binary files a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll and b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll differ
diff --git a/native/org.eclipse.cdt.native.serial/pom.xml b/native/org.eclipse.cdt.native.serial/pom.xml
index d82e0677423..7974013183e 100644
--- a/native/org.eclipse.cdt.native.serial/pom.xml
+++ b/native/org.eclipse.cdt.native.serial/pom.xml
@@ -23,7 +23,7 @@
../../pom.xml
- 1.2.0-SNAPSHOT
+ 1.2.100-SNAPSHOT
org.eclipse.cdt.native.serial
eclipse-plugin
diff --git a/releng/scripts/do_project_settings.sh b/releng/scripts/do_project_settings.sh
index c81e091e1d1..d30f4bfdb1d 100755
--- a/releng/scripts/do_project_settings.sh
+++ b/releng/scripts/do_project_settings.sh
@@ -88,6 +88,24 @@ git ls-files -- \*\*/.project ":!$COREPROJECT/.project" | while read i ; do
else
rm -f $d/.settings/org.eclipse.pde*.prefs
fi
+
+ # CDT (native code)
+ if [[ $natures == *"org.eclipse.cdt.core.cnature"* ]]; then
+ cp $COREPROJECT/.settings/org.eclipse.cdt.*.prefs $d/.settings
+ if echo $i | grep -E '\.tests?[/\.]' > /dev/null; then
+ # Disable indexer for test plugins
+ sed -i '
+ /^eclipse.preferences.version/ {
+ p # Print line
+ i indexer/indexerId=org.eclipse.cdt.core.nullindexer
+ i indexerId=org.eclipse.cdt.core.nullindexer
+ i instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+ d # Already printed
+ }' $d/.settings/org.eclipse.cdt.core.prefs
+ fi
+ else
+ rm -f $d/.settings/org.eclipse.cdt.*.prefs
+ fi
done
##
diff --git a/releng/scripts/do_rebuild_natives.sh b/releng/scripts/do_rebuild_natives.sh
index 62bf4fe9679..92e68783c96 100755
--- a/releng/scripts/do_rebuild_natives.sh
+++ b/releng/scripts/do_rebuild_natives.sh
@@ -23,6 +23,15 @@ for p in native/org.eclipse.cdt.native.serial core/org.eclipse.cdt.core.native;
exit 1
fi
+# Disabled until https://bugs.eclipse.org/bugs/show_bug.cgi?id=568137 is resolved
+# # Need to apply format after header files are generated
+# tmpws=$(mktemp -d)
+# ${ECLIPSE:-~/buildtools/eclipse-cpp-2020-09/eclipse} \
+# -consolelog -nosplash -application org.eclipse.cdt.core.CodeFormatter \
+# -config $p/.settings/org.eclipse.cdt.core.prefs \
+# $p/native_src -verbose -data $tmpws
+# rm -rf $tmpws
+
echo "Rebuilding $p natives to make sure they match source"
logfile=make-natives-${p//\//-}.log
if ! make -C $p/native_src rebuild >${logfile} 2>&1; then