1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Bug 568079: Reformat source code using clang-format

This will enforce formatting when building the native code

Change-Id: I6c047f4c0672609df322b7ba716fc786f0e3aab4
Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
This commit is contained in:
Torbjörn Svensson 2020-10-31 20:54:44 +01:00 committed by Jonah Graham
parent 7f10dce12f
commit 6431307e70
46 changed files with 2707 additions and 3505 deletions

12
.clang-format Normal file
View file

@ -0,0 +1,12 @@
BasedOnStyle: LLVM
# Set column width to 120
ColumnLimit: 120
# Sorting include statements will put "windows.h" last and result in build error.
# To avoid unpredictable build errors, disable sorting.
SortIncludes: false
# Use 4 spaces as indentation
IndentWidth: 4
UseTab: Never

1
.gitattributes vendored
View file

@ -135,6 +135,7 @@ test_commands text
# Other special files
cdtOptions text
.clang-format text
.contentsettings text
*.csv text
*.dia binary

View file

@ -1,189 +0,0 @@
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

View file

@ -1,3 +0,0 @@
eclipse.preferences.version=1
formatter_profile=_Unmanaged profile 'CDT'
formatter_settings_version=1

View file

@ -12,32 +12,30 @@ extern "C" {
* Method: openMaster
* Signature: (Z)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster
(JNIEnv *, jobject, jboolean);
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *, jobject, jboolean);
/*
* Class: org_eclipse_cdt_utils_pty_PTY
* Method: change_window_size
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
(JNIEnv *, jobject, jint, jint, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(JNIEnv *, jobject, jint, jint, jint);
/*
* Class: org_eclipse_cdt_utils_pty_PTY
* Method: exec2
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;Ljava/lang/String;IZ)I
* Signature:
* ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;Ljava/lang/String;IZ)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jobjectArray, jstring, jint, jboolean);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring,
jobjectArray, jstring, jint, jboolean);
/*
* Class: org_eclipse_cdt_utils_pty_PTY
* Method: waitFor
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor
(JNIEnv *, jobject, jint, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor(JNIEnv *, jobject, jint, jint);
#ifdef __cplusplus
}

View file

@ -18,16 +18,14 @@ extern "C" {
* Method: read0
* Signature: (I[BI)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0
(JNIEnv *, jobject, jint, jbyteArray, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv *, jobject, jint, jbyteArray, jint);
/*
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0
(JNIEnv *, jobject, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *, jobject, jint);
#ifdef __cplusplus
}

View file

@ -14,16 +14,14 @@ extern "C" {
* Method: write0
* Signature: (I[BI)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0
(JNIEnv *, jobject, jint, jbyteArray, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv *, jobject, jint, jbyteArray, jint);
/*
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0
(JNIEnv *, jobject, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *, jobject, jint);
#ifdef __cplusplus
}

View file

@ -10,42 +10,42 @@ extern "C" {
/*
* Class: org_eclipse_cdt_utils_spawner_Spawner
* Method: exec0
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;)I
* Signature:
* ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jobjectArray);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *, jobject, jobjectArray, jobjectArray,
jstring, jobjectArray);
/*
* Class: org_eclipse_cdt_utils_spawner_Spawner
* Method: exec1
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *, jobject, jobjectArray, jobjectArray,
jstring);
/*
* Class: org_eclipse_cdt_utils_spawner_Spawner
* Method: exec2
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;Ljava/lang/String;IZ)I
* Signature:
* ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;Ljava/lang/String;IZ)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
(JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jobjectArray, jstring, jint, jboolean);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2(JNIEnv *, jobject, jobjectArray, jobjectArray,
jstring, jobjectArray, jstring, jint, jboolean);
/*
* Class: org_eclipse_cdt_utils_spawner_Spawner
* Method: raise
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
(JNIEnv *, jobject, jint, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *, jobject, jint, jint);
/*
* Class: org_eclipse_cdt_utils_spawner_Spawner
* Method: waitFor
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
(JNIEnv *, jobject, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv *, jobject, jint);
#ifdef __cplusplus
}

View file

@ -18,24 +18,22 @@ extern "C" {
* Method: read0
* Signature: (Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;[BI)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0
(JNIEnv *, jobject, jobject, jbyteArray, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv *, jobject, jobject,
jbyteArray, jint);
/*
* Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
* Method: close0
* Signature: (Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
(JNIEnv *, jobject, jobject);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv *, jobject, jobject);
/*
* Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
* Method: available0
* Signature: (Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_available0
(JNIEnv *, jobject, jobject);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_available0(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}

View file

@ -12,16 +12,15 @@ extern "C" {
* Method: write0
* Signature: (Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;[BI)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0
(JNIEnv *, jobject, jobject, jbyteArray, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv *, jobject, jobject,
jbyteArray, jint);
/*
* Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
* Method: close0
* Signature: (Lorg/eclipse/cdt/utils/spawner/Spawner/IChannel;)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0
(JNIEnv *, jobject, jobject);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}

View file

@ -26,7 +26,7 @@
#include <termios.h>
/* 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) {
@ -58,8 +58,7 @@ pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const c
childpid = fork();
if (childpid < 0) {
fprintf(stderr, "%s(%d): returning due to error: %s\n", __func__,
__LINE__, strerror(errno));
fprintf(stderr, "%s(%d): returning due to error: %s\n", __func__, __LINE__, strerror(errno));
free(full_path);
return -1;
} else if (childpid == 0) { /* child */
@ -154,7 +153,7 @@ pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const c
#ifdef __STAND_ALONE__
int main(int argc, char **argv, char **envp) {
const char *path = "./bufferring_test";
int channels[3] = { -1, -1, -1};
int channels[3] = {-1, -1, -1};
int status;
FILE *app_stdin;
FILE *app_stdout;
@ -174,10 +173,10 @@ int main(int argc, char **argv, char **envp) {
} else {
fputs("foo\n", app_stdin);
fputs("bar\n", app_stdin);
while(fgets(buffer, sizeof buffer, app_stdout) != NULL) {
while (fgets(buffer, sizeof buffer, app_stdout) != NULL) {
fprintf(stdout, "STDOUT: %s\n", buffer);
}
while(fgets(buffer, sizeof buffer, app_stderr) != NULL) {
while (fgets(buffer, sizeof buffer, app_stderr) != NULL) {
fprintf(stdout, "STDERR: %s\n", buffer);
}
}

View file

@ -23,7 +23,7 @@
#include <stdlib.h>
/* 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]) {
int pipe0[2], pipe1[2], pipe2[2];
@ -45,8 +45,7 @@ pid_t exec0(const char *path, char *const argv[], char *const envp[], const char
*/
if (channels != NULL) {
if (pipe(pipe0) < 0 || pipe(pipe1) < 0 || pipe(pipe2) < 0) {
fprintf(stderr, "%s(%d): returning due to error.\n", __func__,
__LINE__);
fprintf(stderr, "%s(%d): returning due to error.\n", __func__, __LINE__);
free(full_path);
return -1;
}

View file

@ -54,8 +54,8 @@ static int channelToFileDesc(JNIEnv *env, jobject channel) {
return fd;
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv *env, jobject jobj, jobject channel, jbyteArray buf,
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;
@ -85,15 +85,15 @@ Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv *env, jobject
return status;
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv *env, jobject jobj, jobject channel) {
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);
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv *env, jobject jobj, jobject channel,
jbyteArray buf, jint buf_len) {
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;
@ -109,8 +109,8 @@ Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv *env, jobje
return status;
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv *env, jobject jobj, jobject channel) {
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);
}

View file

@ -59,11 +59,11 @@ int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct
#define TCSAFLUSH TCSETAF
#endif
if (termp) {
(void) tcsetattr(*aslave, TCSAFLUSH, termp);
(void)tcsetattr(*aslave, TCSAFLUSH, termp);
}
#ifdef TIOCSWINSZ
if (winp) {
(void) ioctl(*aslave, TIOCSWINSZ, (char *)winp);
(void)ioctl(*aslave, TIOCSWINSZ, (char *)winp);
}
#endif
return 0;
@ -91,7 +91,7 @@ int ptym_open(char *pts_name) {
strcpy(pts_name, "/dev/ptmx");
#ifdef __APPLE__
fdm = posix_openpt(O_RDWR|O_NOCTTY);
fdm = posix_openpt(O_RDWR | O_NOCTTY);
#else
fdm = getpt();
#endif

View file

@ -32,7 +32,7 @@
#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");
@ -48,7 +48,7 @@ char* path_val(char *const envp[]) {
return NULL;
}
char* pfind(const char *name, char *const envp[]) {
char *pfind(const char *name, char *const envp[]) {
char *tok;
char *sp;
char *path;
@ -99,8 +99,7 @@ char* pfind(const char *name, char *const envp[]) {
}
#ifdef BUILD_WITH_MAIN
int main(int argc, char **argv)
{
int main(int argc, char **argv) {
int i;
char *fullpath;

View file

@ -21,8 +21,7 @@
* Method: forkpty
* Signature: ()I
*/
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;
int master = -1;
@ -46,7 +45,7 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *env, jobject jobj, jboolea
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);
@ -70,4 +69,3 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(J
return 0;
#endif
}

View file

@ -25,8 +25,8 @@
* Method: read0
* 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) {
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;
@ -63,8 +63,7 @@ Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv *env, jobject jobj, j
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
return close(fd);
}
@ -73,8 +72,8 @@ Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj,
* Method: write0
* 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) {
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;
@ -95,7 +94,6 @@ Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv *env, jobject jobj,
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
return close(fd);
}

View file

@ -44,10 +44,10 @@ static void print_array(char **c_array) {
}
#endif
static char** alloc_c_array(JNIEnv *env, jobjectArray j_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(char*));
char **c_array = calloc(c_array_size + 1, sizeof(char *));
if (c_array == NULL) {
return NULL;
@ -56,7 +56,7 @@ static char** alloc_c_array(JNIEnv *env, jobjectArray j_array) {
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);
c_array[i] = (char *)strdup(c_str);
(*env)->ReleaseStringUTFChars(env, j_str, c_str);
(*env)->DeleteLocalRef(env, j_str);
}
@ -74,7 +74,9 @@ static void free_c_array(char **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) {
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;
@ -117,16 +119,16 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2(JNIEnv *
(*env)->SetObjectArrayElement(env, jchannels, i, chan);
}
bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
bail_out:
(*env)->ReleaseStringUTFChars(env, jdir, dirpath);
(*env)->ReleaseStringUTFChars(env, jslaveName, pts_name);
free_c_array(cmd);
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) {
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;
@ -155,15 +157,16 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *env, jobject jobj, jobj
goto bail_out;
}
bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
bail_out:
(*env)->ReleaseStringUTFChars(env, jdir, dirpath);
free_c_array(cmd);
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) {
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;
@ -213,7 +216,8 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *env, jobject jobj, jobj
(*env)->SetObjectArrayElement(env, jchannels, i, chan);
}
bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
bail_out:
(*env)->ReleaseStringUTFChars(env, jdir, dirpath);
free_c_array(cmd);
free_c_array(envp);
return pid;
@ -224,8 +228,7 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *env, jobject jobj, jobj
* Method: raise
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject jobj, jint pid, jint sig) {
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject jobj, jint pid, jint sig) {
int status = -1;
switch (sig) {
@ -273,7 +276,6 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject jobj, jint
* Method: waitFor
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv *env, jobject jobj, jint pid) {
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv *env, jobject jobj, jint pid) {
return wait0(pid);
}

View file

@ -41,11 +41,15 @@ typedef struct _procInfo {
// (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
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
@ -60,7 +64,7 @@ pProcInfo_t createProcInfo();
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);
@ -100,9 +104,10 @@ 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;
}
@ -113,7 +118,7 @@ void ensureSize(wchar_t **ptr, int *psize, int requiredLength) {
if (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;
} else {
@ -125,10 +130,11 @@ void ensureSize(wchar_t **ptr, int *psize, int requiredLength) {
#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;
PROCESS_INFORMATION pi = {0}, *piCopy;
STARTUPINFOW si;
DWORD flags = 0;
wchar_t *cwd = NULL;
@ -181,7 +187,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
}
nCmdLineLength = MAX_CMD_SIZE;
szCmdLine = (wchar_t*) malloc(nCmdLineLength * sizeof(wchar_t));
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");
@ -204,18 +210,17 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
++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]);
@ -224,7 +229,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
}
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Opened pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Opened pipes: %s, %s, %s\n"), inPipeName, outPipeName,
errPipeName);
OutputDebugStringW(buffer);
#endif
@ -267,7 +273,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
jstring item = (jstring)(*env)->GetObjectArrayElement(env, cmdarray, i);
jsize len = (*env)->GetStringLength(env, item);
int nCpyLen;
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
const wchar_t *str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
if (NULL != str) {
int requiredSize = nPos + len + 2;
if (requiredSize > 32 * 1024) {
@ -287,56 +293,56 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
nPos += nCpyLen;
szCmdLine[nPos] = _T(' ');
++nPos;
(*env)->ReleaseStringChars(env, item, (const jchar*) str);
(*env)->ReleaseStringChars(env, item, (const jchar *)str);
}
}
szCmdLine[nPos] = _T('\0');
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("There are %i environment variables \n"), nEnvVars);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("There are %i environment variables \n"), nEnvVars);
OutputDebugStringW(buffer);
#endif
// Prepare environment block
if (nEnvVars > 0) {
nPos = 0;
szEnvBlock = (wchar_t*) malloc(nBlkSize * sizeof(wchar_t));
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);
const wchar_t *str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
if (NULL != str) {
while ((nBlkSize - nPos) <= (len + 2)) { // +2 for two '\0'
nBlkSize += MAX_ENV_SIZE;
szEnvBlock = (wchar_t*) realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
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);
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);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("%s\n"), str);
OutputDebugStringW(buffer);
#endif
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');
}
if (dir != 0) {
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, 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);
}
}
@ -380,7 +386,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
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);
(char *)&lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
LocalFree(lpMsgBuf);
@ -399,7 +405,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
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);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Process %i failed\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
#endif
cleanUpProcBlock(pCurProcInfo);
@ -408,32 +414,30 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
OutputDebugStringW(_T("Process failed\n"));
#endif
} else {
ret = (long) (pCurProcInfo->uid);
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;
}
/////////////////////////////////////////////////////////////////////////////////////
@ -446,11 +450,12 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
#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 };
PROCESS_INFORMATION pi = {0};
STARTUPINFOW si;
DWORD flags = 0;
wchar_t *cwd = NULL;
@ -466,7 +471,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
wchar_t *szEnvBlock = NULL;
nCmdLineLength = MAX_CMD_SIZE;
szCmdLine = (wchar_t*) malloc(nCmdLineLength * sizeof(wchar_t));
szCmdLine = (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
szCmdLine[0] = 0;
sa.nLength = sizeof(sa);
@ -483,7 +488,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
jstring item = (jstring)(*env)->GetObjectArrayElement(env, cmdarray, i);
jsize len = (*env)->GetStringLength(env, item);
int nCpyLen;
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
const wchar_t *str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
if (NULL != str) {
int requiredSize = nPos + len + 2;
if (requiredSize > 32 * 1024) {
@ -503,7 +508,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
nPos += nCpyLen;
szCmdLine[nPos] = _T(' ');
++nPos;
(*env)->ReleaseStringChars(env, item, (const jchar*) str);
(*env)->ReleaseStringChars(env, item, (const jchar *)str);
}
}
@ -511,16 +516,16 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
// Prepare environment block
if (nEnvVars > 0) {
szEnvBlock = (wchar_t*) malloc(nBlkSize * sizeof(wchar_t));
szEnvBlock = (wchar_t *)malloc(nBlkSize * sizeof(wchar_t));
nPos = 0;
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);
const wchar_t *str = (const wchar_t *)(*env)->GetStringChars(env, item, 0);
if (NULL != str) {
while ((nBlkSize - nPos) <= (len + 2)) { // +2 for two '\0'
nBlkSize += MAX_ENV_SIZE;
szEnvBlock = (wchar_t*) realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
szEnvBlock = (wchar_t *)realloc(szEnvBlock, nBlkSize * sizeof(wchar_t));
if (NULL == szEnvBlock) {
ThrowByName(env, "java/io/Exception", "Not enough memory");
return 0;
@ -530,7 +535,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
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');
@ -538,10 +543,10 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
}
if (dir != 0) {
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, 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);
}
}
@ -570,7 +575,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
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);
(wchar_t *)&lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
LocalFree(lpMsgBuf);
@ -579,11 +584,10 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
// Clean-up
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
ret = (long) pi.dwProcessId; //hProcess;
ret = (long)pi.dwProcessId; // hProcess;
}
return ret;
}
/////////////////////////////////////////////////////////////////////////////////////
@ -595,8 +599,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *
#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;
@ -613,7 +617,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *
}
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Spawner received signal %i for process %i\n"), signal, pCurProcInfo -> pid);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Spawner received signal %i for process %i\n"), signal,
pCurProcInfo->pid);
OutputDebugStringW(buffer);
#endif
@ -634,8 +639,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *
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);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Spawner received TERM signal for process %i\n"),
pCurProcInfo->pid);
OutputDebugStringW(buffer);
#endif
SetEvent(pCurProcInfo->eventTerminate);
@ -647,8 +652,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *
case SIG_KILL:
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Spawner received KILL signal for process %i\n"),
pCurProcInfo -> pid);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Spawner received KILL signal for process %i\n"),
pCurProcInfo->pid);
OutputDebugStringW(buffer);
#endif
SetEvent(pCurProcInfo->eventKill);
@ -673,7 +678,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *
CloseHandle(hProc);
return ret;
}
/////////////////////////////////////////////////////////////////////////////////////
@ -684,7 +688,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *
#ifdef __cplusplus
extern "C"
#endif
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv *env, jobject process, jint uid) {
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;
@ -744,7 +749,7 @@ pProcInfo_t createProcInfo() {
EnterCriticalSection(&cs);
if (NULL == pInfo) {
pInfo = (pProcInfo_t) malloc(sizeof(procInfo_t) * MAX_PROCS);
pInfo = (pProcInfo_t)malloc(sizeof(procInfo_t) * MAX_PROCS);
ZeroMemory(pInfo, sizeof(procInfo_t) * MAX_PROCS);
}
@ -822,7 +827,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;
#ifdef DEBUG_MONITOR
@ -836,7 +841,7 @@ void _cdecl waitProcTermination(void* pv) {
if (pInfo[i].pid == pi->dwProcessId) {
cleanUpProcBlock(pInfo + i);
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("waitProcTermination: set PID %i to 0\n"),
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("waitProcTermination: set PID %i to 0\n"),
pi->dwProcessId);
OutputDebugStringW(buffer);
#endif
@ -887,8 +892,8 @@ int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace
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 still not escaped
if (j == availSpace) {
return -1;

View file

@ -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

View file

@ -48,15 +48,16 @@ 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) {
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);
@ -75,7 +76,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
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);
(wchar_t *)&lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
@ -113,11 +114,12 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
_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,
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);
(wchar_t *)&lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
LocalFree(lpMsgBuf);
@ -160,14 +162,13 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
#endif
#endif
return nBuffOffset; // This is a real full readed length
}
#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
@ -186,8 +187,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_clo
#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);
@ -201,8 +202,9 @@ 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) {
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);
@ -215,7 +217,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_wr
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);
(wchar_t *)&lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
LocalFree(lpMsgBuf);
@ -229,8 +231,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_wr
#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

View file

@ -24,7 +24,7 @@
#include <assert.h>
#include <ctime>
static std::map<int, winpty_t*> fd2pty;
static std::map<int, winpty_t *> fd2pty;
static std::map<int, int> fd2rc;
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *env, jobject jobj, jboolean console) {
@ -49,7 +49,7 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
}
/* 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 */
@ -60,7 +60,7 @@ 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<int, winpty_t*>(master, winpty));
fd2pty.insert(std::pair<int, winpty_t *>(master, winpty));
/* Get a reference to the obj's class */
cls = env->GetObjectClass(jobj);
@ -70,7 +70,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);
@ -81,7 +81,7 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
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<int, winpty_t*>::const_iterator fd2pty_Iter;
std::map<int, winpty_t *>::const_iterator fd2pty_Iter;
fd = fdm;
fd2pty_Iter = fd2pty.find(fd);
@ -100,7 +100,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEn
DWORD amount = -1;
OVERLAPPED over;
int fd;
std::map<int, winpty_t*>::const_iterator fd2pty_Iter;
std::map<int, winpty_t *>::const_iterator fd2pty_Iter;
fd = jfd;
fd2pty_Iter = fd2pty.find(fd);
@ -152,7 +152,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEn
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint jfd) {
int fd;
std::map<int, winpty_t*>::iterator fd2pty_Iter;
std::map<int, winpty_t *>::iterator fd2pty_Iter;
fd = jfd;
fd2pty_Iter = fd2pty.find(fd);
@ -173,7 +173,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNI
DWORD written = -1;
OVERLAPPED over;
int fd;
std::map<int, winpty_t*>::iterator fd2pty_Iter;
std::map<int, winpty_t *>::iterator fd2pty_Iter;
fd = jfd;
fd2pty_Iter = fd2pty.find(fd);
@ -198,7 +198,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNI
if (!ret && GetLastError() == ERROR_IO_PENDING) {
ret = GetOverlappedResult(handle, &over, &written, TRUE);
}
if (!ret || (int) written != buf_len) {
if (!ret || (int)written != buf_len) {
written = -1;
}
@ -211,7 +211,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNI
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint jfd) {
int fd;
std::map<int, winpty_t*>::iterator fd2pty_Iter;
std::map<int, winpty_t *>::iterator fd2pty_Iter;
fd = jfd;
fd2pty_Iter = fd2pty.find(fd);
@ -282,11 +282,12 @@ static std::wstring argvToCommandLine(const std::vector<std::wstring> &argv) {
}
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) {
jobjectArray jenv, jstring jdir, jobjectArray jchannels,
jstring jslaveName, jint masterFD, jboolean console) {
int fd;
std::map<int, winpty_t*>::iterator fd2pty_Iter;
std::map<int, winpty_t *>::iterator fd2pty_Iter;
const wchar_t *cwdW = (const wchar_t*) env->GetStringChars(jdir, NULL);
const wchar_t *cwdW = (const wchar_t *)env->GetStringChars(jdir, NULL);
const char *pts_name = env->GetStringUTFChars(jslaveName, NULL);
int pid = -1;
@ -304,28 +305,28 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2(JNIEnv *env, job
if (fd2pty_Iter != fd2pty.end()) {
winpty_t *winpty = fd2pty_Iter->second;
if (winpty != NULL) {
std::vector < std::wstring > argVector;
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);
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->ReleaseStringChars(j_str, (const jchar *)w_str);
env->DeleteLocalRef(j_str);
}
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);
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->ReleaseStringChars(j_str, (const jchar *)w_str);
env->DeleteLocalRef(j_str);
}
@ -341,7 +342,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2(JNIEnv *env, job
}
}
bail_out: env->ReleaseStringChars(jdir, (const jchar*) cwdW);
bail_out:
env->ReleaseStringChars(jdir, (const jchar *)cwdW);
env->ReleaseStringUTFChars(jslaveName, pts_name);
return pid;
@ -352,7 +354,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor(JNIEnv *env, j
DWORD flags;
int fd;
std::map<int, winpty_t*>::iterator fd2pty_Iter;
std::map<int, winpty_t *>::iterator fd2pty_Iter;
std::map<int, int>::iterator fd2rc_Iter;
fd = masterFD;

View file

@ -6,7 +6,7 @@
static HMODULE getCurrentModule() {
HMODULE module;
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCTSTR) getCurrentModule, &module)) {
(LPCTSTR)getCurrentModule, &module)) {
assert(false);
}
return module;
@ -27,17 +27,17 @@ HMODULE PTYExplicitLoadLibrary(LPCSTR pszModuleName) {
--cchPath;
continue;
}
break; //stop searching; found path separator
break; // stop searching; found path separator
}
lstrcpynA(szPath + cchPath, pszModuleName, MAX_PATH - cchPath);
return LoadLibraryA(szPath); //call with full path to dependent DLL
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 (FARPROC)PTYExplicitLoadLibrary(pdli->szDll);
}
return NULL;
}

View file

@ -31,8 +31,7 @@ static HWND consoleHWND;
// arg - process PID
// Return : TRUE if yes
/////////////////////////////////////////////////////////////////////////////////////
static BOOL CALLBACK
find_child_console(HWND hwnd, LPARAM arg) {
static BOOL CALLBACK find_child_console(HWND hwnd, LPARAM arg) {
DWORD process_id;
DWORD pid = arg;
@ -54,8 +53,7 @@ find_child_console(HWND hwnd, LPARAM arg) {
// 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
/////////////////////////////////////////////////////////////////////////////////////
@ -78,11 +76,10 @@ int interruptProcess(int pid) {
BOOL success = FALSE;
FARPROC procaddr = GetProcAddress(hmod, "DebugBreakProcess");
if (procaddr != NULL) {
HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD) pid);
HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
if (proc != NULL) {
typedef BOOL WINAPI( *DebugBreakProcessFunc)
(HANDLE);
DebugBreakProcessFunc pDebugBreakProcess = (DebugBreakProcessFunc) procaddr;
typedef BOOL WINAPI (*DebugBreakProcessFunc)(HANDLE);
DebugBreakProcessFunc pDebugBreakProcess = (DebugBreakProcessFunc)procaddr;
success = (*pDebugBreakProcess)(proc);
CloseHandle(proc);
}
@ -106,15 +103,15 @@ 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);
BYTE control_scan_code = (BYTE)MapVirtualKey(VK_CONTROL, 0);
/* Fake Ctrl-C for SIGINT, and Ctrl-Break for SIGQUIT. */
BYTE vk_break_code = VK_CANCEL;
BYTE break_scan_code = (BYTE) MapVirtualKey(vk_break_code, 0);
BYTE break_scan_code = (BYTE)MapVirtualKey(vk_break_code, 0);
HWND foreground_window;
foreground_window = GetForegroundWindow();
@ -128,8 +125,8 @@ int interruptProcess(int pid) {
*/
DWORD foreground_thread, child_thread;
foreground_thread = GetWindowThreadProcessId(foreground_window, NULL);
if (foreground_thread == GetCurrentThreadId()
|| !AttachThreadInput(GetCurrentThreadId(), foreground_thread, TRUE)) {
if (foreground_thread == GetCurrentThreadId() ||
!AttachThreadInput(GetCurrentThreadId(), foreground_thread, TRUE)) {
foreground_thread = 0;
}
@ -174,4 +171,3 @@ int interruptProcess(int pid) {
return rc;
}

View file

@ -23,12 +23,13 @@
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) {
BOOL APIENTRY
DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH: {
wchar_t *p;
@ -40,8 +41,7 @@ BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpRese
} else {
wcscat(path, L"\\");
}
}
break;
} break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
@ -51,4 +51,3 @@ BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpRese
}
return TRUE;
}

View file

@ -33,7 +33,7 @@
int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace);
void DisplayErrorMessage();
//BOOL KillProcessEx(DWORD dwProcessId); // Handle of the process
// BOOL KillProcessEx(DWORD dwProcessId); // Handle of the process
///////////////////////////////////////////////////////////////////////////////
BOOL WINAPI HandlerRoutine(DWORD dwCtrlType) { // control signal type
@ -126,7 +126,7 @@ void ensureSize(wchar_t **ptr, int *psize, int requiredLength) {
if (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;
} else {
@ -148,7 +148,7 @@ int main() {
// Construct the full command line
int nCmdLineLength = MAX_CMD_LINE_LENGTH;
wchar_t *szCmdLine = (wchar_t*) malloc(nCmdLineLength * sizeof(wchar_t));
wchar_t *szCmdLine = (wchar_t *)malloc(nCmdLineLength * sizeof(wchar_t));
szCmdLine[0] = 0;
int nPos = 0;
@ -181,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();
@ -193,7 +193,7 @@ int main() {
HANDLE waitEvent = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[4]);
HANDLE h[5];
h[0] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[3]); // simulated SIGINT (CTRL-C or Cygwin 'kill -SIGINT')
// h[1] we reserve for the process handle
// h[1] we reserve for the process handle
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
@ -224,16 +224,15 @@ 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());
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);
#endif
CloseHandle(stdHandles[0]);
@ -245,10 +244,11 @@ 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());
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Failed to reassign standard streams: %i\n"),
GetLastError());
OutputDebugStringW(buffer);
#endif
CloseHandle(stdHandles[0]);
@ -258,7 +258,7 @@ int main() {
}
#ifdef DEBUG_MONITOR_DETAILS
wchar_t * lpvEnv = GetEnvironmentStringsW();
wchar_t *lpvEnv = GetEnvironmentStringsW();
// If the returned pointer is NULL, exit.
if (lpvEnv == NULL) {
@ -268,8 +268,8 @@ int main() {
// terminated by a NULL byte.
OutputDebugStringW(_T("Starter: Environment\n"));
for (wchar_t * lpszVariable = (wchar_t *) lpvEnv; *lpszVariable; lpszVariable += wcslen(lpszVariable) + 1) {
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("%s\n"), lpszVariable);
for (wchar_t *lpszVariable = (wchar_t *)lpvEnv; *lpszVariable; lpszVariable += wcslen(lpszVariable) + 1) {
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("%s\n"), lpszVariable);
OutputDebugStringW(buffer);
}
@ -277,7 +277,7 @@ int main() {
}
#endif
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Starting: %s\n"), szCmdLine);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Starting: %s\n"), szCmdLine);
OutputDebugStringW(buffer);
#endif
// Create job object
@ -318,7 +318,7 @@ int main() {
if (f) {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Process %i started\n"), pi.dwProcessId);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Process %i started\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
#endif
SetEvent(waitEvent); // Means that process has been spawned
@ -328,7 +328,8 @@ int main() {
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);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Cannot assign process %i to a job\n"),
pi.dwProcessId);
OutputDebugStringW(buffer);
DisplayErrorMessage();
#endif
@ -343,7 +344,8 @@ int main() {
case WAIT_OBJECT_0 + 0: // SIGINT
case WAIT_OBJECT_0 + 4: // CTRL-C
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("starter (PID %i) received CTRL-C event\n"), currentPID);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("starter (PID %i) received CTRL-C event\n"),
currentPID);
OutputDebugStringW(buffer);
#endif
if ((event == (WAIT_OBJECT_0 + 0)) && isCygwin(h[1])) {
@ -364,8 +366,8 @@ int main() {
case WAIT_OBJECT_0 + 1: // App terminated normally
// Make it's exit code our exit code
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("starter: launched process has been terminated(PID %i)\n"),
pi.dwProcessId);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]),
_T("starter: launched process has been terminated(PID %i)\n"), pi.dwProcessId);
OutputDebugStringW(buffer);
#endif
GetExitCodeProcess(pi.hProcess, &dwExitCode);
@ -381,7 +383,8 @@ int main() {
{
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);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("starter received %s event (PID %i)\n"), signal,
currentPID);
OutputDebugStringW(buffer);
#endif
if (isCygwin(h[1])) {
@ -399,7 +402,7 @@ int main() {
SetEvent(waitEvent);
if (NULL != hJob) {
if (!TerminateJobObject(hJob, (DWORD) - 1)) {
if (!TerminateJobObject(hJob, (DWORD)-1)) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Cannot terminate job\n"));
DisplayErrorMessage();
@ -419,11 +422,10 @@ int main() {
exitProc = TRUE;
break;
}
}
} else {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Cannot start: %s\n"), szCmdLine);
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), _T("Cannot start: %s\n"), szCmdLine);
OutputDebugStringW(buffer);
DisplayErrorMessage();
@ -482,8 +484,8 @@ int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace
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;
@ -517,7 +519,7 @@ 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, 0, NULL);
OutputDebugStringW(lpMsgBuf);
// Free the buffer.
LocalFree(lpMsgBuf);

View file

@ -1,192 +1,5 @@
#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

View file

@ -1,3 +0,0 @@
eclipse.preferences.version=1
formatter_profile=_Unmanaged profile 'CDT'
formatter_settings_version=1

View file

@ -1,189 +0,0 @@
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

View file

@ -1,3 +0,0 @@
eclipse.preferences.version=1
formatter_profile=_Unmanaged profile 'CDT'
formatter_settings_version=1

View file

@ -1,189 +0,0 @@
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

View file

@ -1,3 +0,0 @@
eclipse.preferences.version=1
formatter_profile=_Unmanaged profile 'CDT'
formatter_settings_version=1

View file

@ -12,56 +12,50 @@ extern "C" {
* Method: open0
* Signature: (Ljava/lang/String;IIII)J
*/
JNIEXPORT jlong JNICALL Java_org_eclipse_cdt_serial_SerialPort_open0
(JNIEnv *, jobject, jstring, jint, jint, jint, jint);
JNIEXPORT jlong JNICALL Java_org_eclipse_cdt_serial_SerialPort_open0(JNIEnv *, jobject, jstring, jint, jint, jint,
jint);
/*
* Class: org_eclipse_cdt_serial_SerialPort
* Method: close0
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_close0
(JNIEnv *, jobject, jlong);
JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_close0(JNIEnv *, jobject, jlong);
/*
* Class: org_eclipse_cdt_serial_SerialPort
* Method: read1
* Signature: (J[BII)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_serial_SerialPort_read1
(JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_serial_SerialPort_read1(JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
/*
* Class: org_eclipse_cdt_serial_SerialPort
* Method: available0
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_serial_SerialPort_available0
(JNIEnv *, jobject, jlong);
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_serial_SerialPort_available0(JNIEnv *, jobject, jlong);
/*
* Class: org_eclipse_cdt_serial_SerialPort
* Method: write0
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_write0
(JNIEnv *, jobject, jlong, jint);
JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_write0(JNIEnv *, jobject, jlong, jint);
/*
* Class: org_eclipse_cdt_serial_SerialPort
* Method: write1
* Signature: (J[BII)V
*/
JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_write1
(JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_write1(JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
/*
* Class: org_eclipse_cdt_serial_SerialPort
* Method: getPortName
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_serial_SerialPort_getPortName
(JNIEnv *, jclass, jint);
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_serial_SerialPort_getPortName(JNIEnv *, jclass, jint);
#ifdef __cplusplus
}

View file

@ -38,7 +38,7 @@
#include <jni.h>
#include <org_eclipse_cdt_serial_SerialPort.h>
#define FUNC(x) Java_org_eclipse_cdt_serial_SerialPort_ ## x
#define FUNC(x) Java_org_eclipse_cdt_serial_SerialPort_##x
/**
* Use this method to throw an exception when open fails after the OS open
@ -204,7 +204,8 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
}
#else
// On OSX speed_t is simply the baud rate: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/cfsetispeed.3.html
// On OSX speed_t is simply the baud rate:
// https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/cfsetispeed.3.html
cfsetispeed(&options, baudRate);
cfsetospeed(&options, baudRate);
#endif
@ -224,7 +225,6 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
case 8:
options.c_cflag |= CS8;
break;
}
// set parity
@ -267,26 +267,21 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
return fd;
#else // __MINGW32__
const wchar_t * cportName = (const wchar_t *)(*env)->GetStringChars(env, portName, NULL);
HANDLE handle = CreateFile(cportName,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
const wchar_t *cportName = (const wchar_t *)(*env)->GetStringChars(env, portName, NULL);
HANDLE handle =
CreateFile(cportName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
(*env)->ReleaseStringChars(env, portName, cportName);
if (handle == INVALID_HANDLE_VALUE) {
char msg[256];
const char * name = (*env)->GetStringUTFChars(env, portName, NULL);
const char *name = (*env)->GetStringUTFChars(env, portName, NULL);
sprintf_s(msg, sizeof(msg), "Error opening %s", name);
(*env)->ReleaseStringUTFChars(env, portName, name);
throwIOException(env, msg);
return -1;
}
DCB dcb = { 0 };
DCB dcb = {0};
if (!GetCommState(handle, &dcb)) {
closeAndthrowIOException(handle, env, "Error getting DCB");
@ -325,7 +320,7 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
return -1;
}
COMMTIMEOUTS timeouts = { 0 };
COMMTIMEOUTS timeouts = {0};
timeouts.ReadIntervalTimeout = MAXDWORD;
timeouts.ReadTotalTimeoutMultiplier = MAXDWORD;
timeouts.ReadTotalTimeoutConstant = 200;
@ -342,8 +337,7 @@ 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);
#else
@ -390,7 +384,7 @@ JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv *env, jobject jobj, jlong jhandle, jby
}
return n;
#else
OVERLAPPED olp = { 0 };
OVERLAPPED olp = {0};
olp.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (olp.hEvent == NULL) {
@ -434,13 +428,12 @@ JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv *env, jobject jobj, jlong jhandle, jby
#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;
write(jhandle, &buff, 1);
#else
OVERLAPPED olp = { 0 };
OVERLAPPED olp = {0};
olp.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (olp.hEvent == NULL) {
@ -459,8 +452,7 @@ JNIEXPORT void JNICALL FUNC(write0)
if (!WriteFile(handle, &buff, sizeof(buff), &nwritten, &olp)) {
if (GetLastError() != ERROR_IO_PENDING) {
throwIOException(env, "Error writing to port");
}
else {
} else {
switch (WaitForSingleObject(olp.hEvent, INFINITE)) {
case WAIT_OBJECT_0:
if (!GetOverlappedResult(handle, &olp, &nwritten, FALSE)) {
@ -474,7 +466,8 @@ JNIEXPORT void JNICALL FUNC(write0)
#endif
}
JNIEXPORT void JNICALL FUNC(write1)(JNIEnv *env, jobject jobj, jlong jhandle, jbyteArray bytes, jint offset, jint size) {
JNIEXPORT void JNICALL FUNC(write1)(JNIEnv *env, jobject jobj, jlong jhandle, jbyteArray bytes, jint offset,
jint size) {
#ifndef __MINGW32__
while (size > 0) {
jbyte buff[256];
@ -488,7 +481,7 @@ JNIEXPORT void JNICALL FUNC(write1)(JNIEnv *env, jobject jobj, jlong jhandle, jb
offset += n;
}
#else
OVERLAPPED olp = { 0 };
OVERLAPPED olp = {0};
olp.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (olp.hEvent == NULL) {
@ -529,8 +522,7 @@ JNIEXPORT void JNICALL FUNC(write1)(JNIEnv *env, jobject jobj, jlong jhandle, jb
}
#ifdef __MINGW32__
JNIEXPORT jstring FUNC(getPortName)(JNIEnv *env, jclass cls, jint i)
{
JNIEXPORT jstring FUNC(getPortName)(JNIEnv *env, jclass cls, jint i) {
HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\SERIALCOMM", 0, KEY_READ, &key) != ERROR_SUCCESS) {
@ -558,7 +550,7 @@ JNIEXPORT jstring FUNC(getPortName)(JNIEnv *env, jclass cls, jint i)
return NULL;
}
jstring result = (*env)->NewString(env, (jchar *)value, (jsize) wcslen(value));
jstring result = (*env)->NewString(env, (jchar *)value, (jsize)wcslen(value));
RegCloseKey(key);
return result;
}

View file

@ -88,24 +88,6 @@ 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
##

View file

@ -23,14 +23,9 @@ 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
# Need to apply format after header files are generated
echo "Applying enforcing formatting rules to $p native source files"
clang-format -i --style=file $(git ls-files $p/native_src/\*\*/\*.{c,cpp,cc,h,hh,hpp})
echo "Rebuilding $p natives to make sure they match source"
logfile=make-natives-${p//\//-}.log