1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 568079: Format C/C++ code

Added a new C/C++ formatter profile called "Unmanaged profile 'CDT'"
(name stolen from the Java formatter) that is basically K&R with the
tweak of maxium line width set to 120 (same width as for .java files).

Added enforcement of the formatter during build.

libspawner.so/jnilib have differences because the re-formatting changes
line numbers and therefore the __LINE__ macro expands to a different
value.

Change-Id: Id3a0619cb31640c7817dc684c72139f90cab0fc6
Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
This commit is contained in:
Torbjörn Svensson 2020-10-21 19:59:07 +02:00 committed by Jonah Graham
parent 0429be17e1
commit c5a53bb7fe
55 changed files with 2025 additions and 1530 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.linux.aarch64
Bundle-SymbolicName: org.eclipse.cdt.core.linux.aarch64;singleton:=true
Bundle-Version: 6.0.0.qualifier
Bundle-Version: 6.0.100.qualifier
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Localization: plugin

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>6.0.0-SNAPSHOT</version>
<version>6.0.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.aarch64</artifactId>
<packaging>eclipse-plugin</packaging>

View file

@ -3,7 +3,7 @@ Bundle-SymbolicName: org.eclipse.cdt.core.linux.ppc64le;singleton:=true
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-Name: %fragmentName.linux.ppc64le
Bundle-Version: 6.0.0.qualifier
Bundle-Version: 6.0.100.qualifier
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Vendor: %providerName
Eclipse-PlatformFilter: (&(osgi.os=linux)(osgi.arch=ppc64le))

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>6.0.0-SNAPSHOT</version>
<version>6.0.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.ppc64le</artifactId>
<packaging>eclipse-plugin</packaging>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.linux.x86_64
Bundle-SymbolicName: org.eclipse.cdt.core.linux.x86_64;singleton:=true
Bundle-Version: 6.0.0.qualifier
Bundle-Version: 6.0.100.qualifier
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Localization: plugin

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>6.0.0-SNAPSHOT</version>
<version>6.0.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.x86_64</artifactId>
<packaging>eclipse-plugin</packaging>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.macosx
Bundle-SymbolicName: org.eclipse.cdt.core.macosx; singleton:=true
Bundle-Version: 6.0.0.qualifier
Bundle-Version: 6.0.100.qualifier
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Bundle-Localization: plugin

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>6.0.0-SNAPSHOT</version>
<version>6.0.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.macosx</artifactId>
<packaging>eclipse-plugin</packaging>

View file

@ -30,5 +30,6 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,189 @@
eclipse.preferences.version=1
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
org.eclipse.cdt.core.formatter.alignment_for_member_access=0
org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
org.eclipse.cdt.core.formatter.compact_else_if=true
org.eclipse.cdt.core.formatter.continuation_indentation=2
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.cdt.core.formatter.format_block_comment=true
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.cdt.core.formatter.format_header_comment=true
org.eclipse.cdt.core.formatter.format_line_comment=true
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
org.eclipse.cdt.core.formatter.indent_empty_lines=false
org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.cdt.core.formatter.indentation.size=4
org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.join_wrapped_lines=true
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.cdt.core.formatter.lineSplit=120
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.cdt.core.formatter.tabulation.char=tab
org.eclipse.cdt.core.formatter.tabulation.size=4
org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false

View file

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

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core.native;singleton:=true
Bundle-Version: 6.0.0.qualifier
Bundle-Version: 6.0.100.qualifier
Bundle-Activator: org.eclipse.cdt.internal.core.natives.CNativePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -19,14 +19,9 @@
#include <signal.h>
#include <errno.h>
extern pid_t exec0(const char *path, char *const argv[],
char *const envp[], const char *dirpath,
int channels[3]);
extern pid_t exec0(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3]);
extern pid_t exec_pty(const char *path, char *const argv[],
char *const envp[], const char *dirpath,
int channels[3], const char *pts_name, int fdm,
int console);
extern pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3],
const char *pts_name, int fdm, int console);
extern int wait0(pid_t pid);

View file

@ -28,10 +28,8 @@
/* from pfind.c */
extern char* pfind(const char *name, char *const envp[]);
pid_t
exec_pty(const char *path, char *const argv[], char *const envp[],
const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
{
pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3],
const char *pts_name, int fdm, int console) {
int pipe2[2];
pid_t childpid;
char *full_path;
@ -60,7 +58,8 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
childpid = fork();
if (childpid < 0) {
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__,
__LINE__, strerror(errno));
free(full_path);
return -1;
} else if (childpid == 0) { /* child */

View file

@ -25,10 +25,7 @@
/* from pfind.c */
extern char* pfind(const char *name, char *const envp[]);
pid_t
exec0(const char *path, char *const argv[], char *const envp[],
const char *dirpath, int channels[3])
{
pid_t exec0(const char *path, char *const argv[], char *const envp[], const char *dirpath, int channels[3]) {
int pipe0[2], pipe1[2], pipe2[2];
pid_t childpid;
char *full_path;
@ -48,8 +45,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
*/
if (channels != NULL) {
if (pipe(pipe0) < 0 || pipe(pipe1) < 0 || pipe(pipe2) < 0) {
fprintf(stderr, "%s(%d): returning due to error.\n",
__FUNCTION__, __LINE__);
fprintf(stderr, "%s(%d): returning due to error.\n", __FUNCTION__,
__LINE__);
free(full_path);
return -1;
}
@ -58,8 +55,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
childpid = fork();
if (childpid < 0) {
fprintf(stderr, "%s(%d): returning due to error: %s\n",
__FUNCTION__, __LINE__, strerror(errno));
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__,
__LINE__, strerror(errno));
free(full_path);
return -1;
} else if (childpid == 0) { /* child */
@ -135,9 +132,7 @@ exec0(const char *path, char *const argv[], char *const envp[],
return -1; /*NOT REACHED */
}
int wait0(pid_t pid)
{
int wait0(pid_t pid) {
int status;
int val = -1;

View file

@ -21,8 +21,7 @@
/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerInputStream */
/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerOutputStream */
static void ThrowByName(JNIEnv *env, const char *name, const char *msg)
{
static void ThrowByName(JNIEnv *env, const char *name, const char *msg) {
jclass cls = (*env)->FindClass(env, name);
if (cls != 0) /* Otherwise an exception has already been thrown */
@ -32,8 +31,7 @@ static void ThrowByName(JNIEnv *env, const char *name, const char *msg)
(*env)->DeleteLocalRef(env, cls);
}
static int channelToFileDesc(JNIEnv * env, jobject channel)
{
static int channelToFileDesc(JNIEnv *env, jobject channel) {
if (channel == 0) {
ThrowByName(env, "java/io/IOException", "Invalid channel object");
return -1;
@ -56,12 +54,8 @@ static int channelToFileDesc(JNIEnv * env, jobject channel)
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv * env,
jobject jobj,
jobject channel,
jbyteArray buf,
jint buf_len)
{
Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv *env, jobject jobj, jobject channel, jbyteArray buf,
jint buf_len) {
int fd;
int status;
jbyte *data;
@ -90,23 +84,15 @@ Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv * env,
return status;
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv * env,
jobject jobj,
jobject channel)
{
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)
{
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;
@ -122,12 +108,8 @@ Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv * env,
return status;
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv * env,
jobject jobj,
jobject channel)
{
Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv *env, jobject jobj, jobject channel) {
int fd = channelToFileDesc(env, channel);
return close(fd);
}

View file

@ -39,9 +39,7 @@ int ptym_open (char *pts_name);
int ptys_open(int fdm, const char *pts_name);
void set_noecho(int fd);
int
openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp)
{
int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) {
char line[20];
line[0] = 0;
*amaster = ptym_open(line);
@ -67,9 +65,7 @@ openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct win
return 0;
}
void
set_noecho(int fd)
{
void set_noecho(int fd) {
struct termios stermios;
if (tcgetattr(fd, &stermios) < 0) {
return;
@ -85,9 +81,7 @@ set_noecho(int fd)
tcsetattr(fd, TCSANOW, &stermios);
}
int
ptym_open(char * pts_name)
{
int ptym_open(char *pts_name) {
int fdm;
char *ptr;
@ -116,9 +110,7 @@ ptym_open(char * pts_name)
return fdm; /* return fd of master */
}
int
ptys_open(int fdm, const char * pts_name)
{
int ptys_open(int fdm, const char *pts_name) {
int fds;
/* following should allocate controlling terminal */
fds = open(pts_name, O_RDWR);

View file

@ -32,8 +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,8 +47,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;

View file

@ -54,9 +54,8 @@ Java_org_eclipse_cdt_utils_pty_PTY_openMaster (JNIEnv *env, jobject jobj, jboole
return jstr;
}
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size
(JNIEnv *env, jobject jobj, jint fdm, jint width, jint height)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(JNIEnv *env, jobject jobj, jint fdm,
jint width, jint height) {
#ifdef TIOCSWINSZ
struct winsize win;

View file

@ -26,12 +26,7 @@
* 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)
{
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;
@ -64,17 +59,13 @@ Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv * env,
return status;
}
/*
* Class: org_eclipse_cdt_utils_pty_PTYInputStream
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv * env,
jobject jobj,
jint fd)
{
Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
return close(fd);
}
@ -84,12 +75,7 @@ Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv * env,
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv * env,
jobject jobj,
jint jfd,
jbyteArray buf,
jint buf_len)
{
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;
@ -105,16 +91,12 @@ Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv * env,
return status;
}
/*
* Class: org_eclipse_cdt_utils_pty_PTYOutputStream
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv * env,
jobject jobj,
jint fd)
{
Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint fd) {
return close(fd);
}

View file

@ -23,15 +23,12 @@
#include "exec0.h"
#include <org_eclipse_cdt_utils_spawner_Spawner.h>
#define DEBUGIT 0
/*
* Header for class org_eclipse_cdt_utils_spawner_Spawner
*/
#if DEBUGIT
static void print_array(char **c_array)
{
@ -49,9 +46,7 @@ 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(*c_array));
@ -60,8 +55,7 @@ static char **alloc_c_array(JNIEnv * env, jobjectArray j_array)
return NULL;
for (i = 0; i < c_array_size; i++) {
jstring j_str =
(jstring) (*env)->GetObjectArrayElement(env, j_array, i);
jstring j_str = (jstring)(*env)->GetObjectArrayElement(env, j_array, i);
const char *c_str = (*env)->GetStringUTFChars(env, j_str, NULL);
c_array[i] = (char*) strdup(c_str);
(*env)->ReleaseStringUTFChars(env, j_str, c_str);
@ -71,9 +65,7 @@ static char **alloc_c_array(JNIEnv * env, jobjectArray j_array)
return c_array;
}
static void free_c_array(char **c_array)
{
static void free_c_array(char **c_array) {
if (c_array) {
char **p = c_array;
for (; *p; p++) {
@ -85,11 +77,8 @@ 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)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2(JNIEnv *env, jobject jobj, jobjectArray jcmd,
jobjectArray jenv, jstring jdir, jobjectArray jchannels, jstring jslaveName, jint masterFD, jboolean console) {
const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
char **cmd = NULL;
@ -128,9 +117,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
(*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);
if (cmd)
free_c_array(cmd);
@ -139,13 +126,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
return pid;
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
jobjectArray jcmd,
jobjectArray jenv,
jstring jdir)
{
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;
@ -171,8 +154,7 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
if (pid < 0)
goto bail_out;
bail_out:
(*env)->ReleaseStringUTFChars(env, jdir, dirpath);
bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
if (cmd)
free_c_array(cmd);
if (envp)
@ -181,12 +163,8 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
}
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
jobjectArray jcmd,
jobjectArray jenv,
jstring jdir,
jobjectArray jchannels)
{
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;
@ -230,8 +208,7 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
(*env)->SetObjectArrayElement(env, jchannels, i, chan);
}
bail_out:
(*env)->ReleaseStringUTFChars(env, jdir, dirpath);
bail_out: (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
if (cmd)
free_c_array(cmd);
if (envp)
@ -245,9 +222,7 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * env, jobject jobj,
jint pid, jint sig)
{
Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject jobj, jint pid, jint sig) {
int status = -1;
switch (sig) {
@ -290,16 +265,12 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * env, jobject jobj,
return status;
}
/*
* Class: org_eclipse_cdt_utils_spawner_Spawner
* Method: waitFor
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv * env,
jobject jobj, jint pid)
{
Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv *env, jobject jobj, jint pid) {
return wait0(pid);
}

View file

@ -34,7 +34,6 @@
#define MAX_PROCS (100) // Maximum number of simultaneously running processes
// Process description block. Should be created for each launched process
typedef struct _procInfo {
int pid; // Process ID
@ -51,7 +50,6 @@ typedef struct _procInfo {
static int procCounter = 0; // Number of running processes
// This is a VM helper
void ThrowByName(JNIEnv *env, const char *name, const char *msg);
@ -72,25 +70,22 @@ static void cleanUpProcBlock(pProcInfo_t pCurProcInfo);
int interruptProcess(int pid);
// Signal codes
typedef enum {
SIG_NOOP,
SIG_HUP,
SIG_INT,
SIG_KILL = 9,
SIG_TERM = 15,
SIG_NOOP, //
SIG_HUP, //
SIG_INT, //
SIG_KILL = 9, //
SIG_TERM = 15, //
CTRLC = 1000 // special, Windows only. Sends CTRL-C in all cases, even when inferior is a Cygwin program
} signals;
extern CRITICAL_SECTION cs;
extern wchar_t path[MAX_PATH]; // Directory where spawner.dll is located
static HMODULE hVM = NULL; // VM handler
static pProcInfo_t pInfo = NULL;
static int nCounter = 0; // We use it to build unique synchronization object names
@ -107,14 +102,13 @@ static int nCounter = 0; // We use it to build unique synchronization object nam
#ifdef __cplusplus
extern "C"
#endif
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
(JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir, jobjectArray channels, jstring slaveName, jint fdm, jboolean console)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2(JNIEnv *env, jobject process,
jobjectArray cmdarray, jobjectArray envp, jstring dir, jobjectArray channels, jstring slaveName, jint fdm,
jboolean console) {
return -1;
}
void ensureSize(wchar_t** ptr, int* psize, int requiredLength)
{
void ensureSize(wchar_t **ptr, int *psize, int requiredLength) {
int size = *psize;
if (requiredLength > size) {
size = 2 * size;
@ -124,8 +118,7 @@ void ensureSize(wchar_t** ptr, int* psize, int requiredLength)
*ptr = (wchar_t*) realloc(*ptr, size * sizeof(wchar_t));
if (NULL == *ptr) {
*psize = 0;
}
else {
} else {
*psize = size;
}
}
@ -134,9 +127,8 @@ 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;
STARTUPINFOW si;
@ -174,22 +166,19 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
jclass channelClass = NULL;
jmethodID channelConstructor = NULL;
if (channels == NULL)
{
if (channels == NULL) {
ThrowByName(env, "java/io/IOException", "Channels can't be null");
return 0;
}
channelClass = (*env)->FindClass(env, "org/eclipse/cdt/utils/spawner/Spawner$WinChannel");
if (channelClass == 0)
{
if (channelClass == 0) {
ThrowByName(env, "java/io/IOException", "Unable to find channel class");
return 0;
}
channelConstructor = (*env)->GetMethodID(env, channelClass, "<init>", "(J)V");
if (channelConstructor == 0)
{
if (channelConstructor == 0) {
ThrowByName(env, "java/io/IOException", "Unable to find channel constructor");
return 0;
}
@ -197,14 +186,12 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
nCmdLineLength = MAX_CMD_SIZE;
szCmdLine = (wchar_t*) malloc(nCmdLineLength * sizeof(wchar_t));
szCmdLine[0] = _T('\0');
if((HIBYTE(LOWORD(GetVersion()))) & 0x80)
{
if ((HIBYTE(LOWORD(GetVersion()))) & 0x80) {
ThrowByName(env, "java/io/IOException", "Does not support Windows 3.1/95/98/Me");
return 0;
}
if (cmdarray == 0)
{
if (cmdarray == 0) {
ThrowByName(env, "java/lang/NullPointerException", "No command line specified");
return 0;
}
@ -220,15 +207,18 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
++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]);
@ -241,28 +231,28 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
OutputDebugStringW(buffer);
#endif
nCmdTokens = (*env)->GetArrayLength(env, cmdarray);
nEnvVars = (*env)->GetArrayLength(env, envp);
pCurProcInfo = createProcInfo();
if(NULL == pCurProcInfo)
{
if (NULL == pCurProcInfo) {
ThrowByName(env, "java/io/IOException", "Too many processes");
return 0;
}
// Construct starter's command line
swprintf(eventBreakName, sizeof(eventBreakName)/sizeof(eventBreakName[0]), L"SABreak%04x%08x", pid, nLocalCounter);
swprintf(eventBreakName, sizeof(eventBreakName) / sizeof(eventBreakName[0]), L"SABreak%04x%08x", pid,
nLocalCounter);
swprintf(eventWaitName, sizeof(eventWaitName) / sizeof(eventWaitName[0]), L"SAWait%04x%08x", pid, nLocalCounter);
swprintf(eventTerminateName, sizeof(eventTerminateName)/sizeof(eventTerminateName[0]), L"SATerm%04x%08x", pid, nLocalCounter);
swprintf(eventTerminateName, sizeof(eventTerminateName) / sizeof(eventTerminateName[0]), L"SATerm%04x%08x", pid,
nLocalCounter);
swprintf(eventKillName, sizeof(eventKillName) / sizeof(eventKillName[0]), L"SAKill%04x%08x", pid, nLocalCounter);
swprintf(eventCtrlcName, sizeof(eventCtrlcName)/sizeof(eventCtrlcName[0]), L"SACtrlc%04x%08x", pid, nLocalCounter);
swprintf(eventCtrlcName, sizeof(eventCtrlcName) / sizeof(eventCtrlcName[0]), L"SACtrlc%04x%08x", pid,
nLocalCounter);
pCurProcInfo->eventBreak = CreateEventW(NULL, FALSE, FALSE, eventBreakName);
if(NULL == pCurProcInfo->eventBreak || GetLastError() == ERROR_ALREADY_EXISTS)
{
if (NULL == pCurProcInfo->eventBreak || GetLastError() == ERROR_ALREADY_EXISTS) {
ThrowByName(env, "java/io/IOException", "Cannot create event");
return 0;
}
@ -271,18 +261,17 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
pCurProcInfo->eventKill = CreateEventW(NULL, FALSE, FALSE, eventKillName);
pCurProcInfo->eventCtrlc = CreateEventW(NULL, FALSE, FALSE, eventCtrlcName);
swprintf(szCmdLine, nCmdLineLength, L"\"%sstarter.exe\" %i %i %s %s %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName, eventKillName, eventCtrlcName);
swprintf(szCmdLine, nCmdLineLength, L"\"%sstarter.exe\" %i %i %s %s %s %s %s ", path, pid, nLocalCounter,
eventBreakName, eventWaitName, eventTerminateName, eventKillName, eventCtrlcName);
nPos = wcslen(szCmdLine);
// Prepare command line
for(i = 0; i < nCmdTokens; ++i)
{
for (i = 0; i < nCmdTokens; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, cmdarray, i);
jsize len = (*env)->GetStringLength(env, item);
int nCpyLen;
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
if(NULL != str)
{
if (NULL != str) {
int requiredSize = nPos + len + 2;
if (requiredSize > 32 * 1024) {
ThrowByName(env, "java/io/IOException", "Command line too long");
@ -294,8 +283,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
return 0;
}
if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos)))
{
if (0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos))) {
ThrowByName(env, "java/io/IOException", "Command line too long");
return 0;
}
@ -312,23 +300,19 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
OutputDebugStringW(buffer);
#endif
// Prepare environment block
if (nEnvVars > 0)
{
if (nEnvVars > 0) {
nPos = 0;
szEnvBlock = (wchar_t*) malloc(nBlkSize * sizeof(wchar_t));
for(i = 0; i < nEnvVars; ++i)
{
for (i = 0; i < nEnvVars; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, envp, i);
jsize len = (*env)->GetStringLength(env, item);
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
if(NULL != str)
{
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));
if(NULL == szEnvBlock)
{
if (NULL == szEnvBlock) {
ThrowByName(env, "java/io/IOException", "Not enough memory");
return 0;
}
@ -352,26 +336,19 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
szEnvBlock[nPos] = _T('\0');
}
if (dir != 0)
{
if (dir != 0) {
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, dir, 0);
if(NULL != str)
{
if (NULL != str) {
cwd = wcsdup(str);
(*env)->ReleaseStringChars(env, dir, (const jchar*) str);
}
}
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE; // Processes in the Process Group are hidden
SetHandleInformation(stdHandles[0], HANDLE_FLAG_INHERIT, FALSE);
SetHandleInformation(stdHandles[1], HANDLE_FLAG_INHERIT, FALSE);
SetHandleInformation(stdHandles[2], HANDLE_FLAG_INHERIT, FALSE);
@ -411,25 +388,15 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
CloseHandle(stdHandles[0]);
CloseHandle(stdHandles[1]);
CloseHandle(stdHandles[2]);
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(char *)&lpMsgBuf,
0,
NULL
);
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(char*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
LocalFree(lpMsgBuf);
cleanUpProcBlock(pCurProcInfo);
ret = -1;
}
else
{
} else {
HANDLE h[2];
int what;
@ -451,9 +418,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Process failed\n"));
#endif
}
else
{
} else {
ret = (long) (pCurProcInfo->uid);
// Prepare stream handlers to return to java program
@ -482,7 +447,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
}
/////////////////////////////////////////////////////////////////////////////////////
// Launcher; just launches process and don't care about it any more
// Arguments: (see Spawner.java)
@ -493,9 +457,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
#ifdef __cplusplus
extern "C"
#endif
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
(JNIEnv * env, jobject process, jobjectArray cmdarray, jobjectArray envp, jstring dir)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv *env, jobject process,
jobjectArray cmdarray, jobjectArray envp, jstring dir) {
SECURITY_ATTRIBUTES sa;
PROCESS_INFORMATION pi = { 0 };
@ -521,21 +484,18 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
sa.lpSecurityDescriptor = 0;
sa.bInheritHandle = TRUE;
nCmdTokens = (*env)->GetArrayLength(env, cmdarray);
nEnvVars = (*env)->GetArrayLength(env, envp);
nPos = 0;
// Prepare command line
for(i = 0; i < nCmdTokens; ++i)
{
for (i = 0; i < nCmdTokens; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, cmdarray, i);
jsize len = (*env)->GetStringLength(env, item);
int nCpyLen;
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
if(NULL != str)
{
if (NULL != str) {
int requiredSize = nPos + len + 2;
if (requiredSize > 32 * 1024) {
ThrowByName(env, "java/io/IOException", "Command line too long");
@ -547,8 +507,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
return 0;
}
if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos)))
{
if (0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, nCmdLineLength - nPos))) {
ThrowByName(env, "java/io/Exception", "Command line too long");
return 0;
}
@ -562,23 +521,19 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
szCmdLine[nPos] = _T('\0');
// Prepare environment block
if (nEnvVars > 0)
{
if (nEnvVars > 0) {
szEnvBlock = (wchar_t*) malloc(nBlkSize * sizeof(wchar_t));
nPos = 0;
for(i = 0; i < nEnvVars; ++i)
{
for (i = 0; i < nEnvVars; ++i) {
jstring item = (jstring)(*env)->GetObjectArrayElement(env, envp, i);
jsize len = (*env)->GetStringLength(env, item);
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, item, 0);
if(NULL != str)
{
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));
if(NULL == szEnvBlock)
{
if (NULL == szEnvBlock) {
ThrowByName(env, "java/io/Exception", "Not enough memory");
return 0;
}
@ -594,26 +549,17 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
envBlk = szEnvBlock;
}
if (dir != 0)
{
if (dir != 0) {
const wchar_t *str = (const wchar_t*) (*env)->GetStringChars(env, dir, 0);
if(NULL != str)
{
if (NULL != str) {
cwd = wcsdup(str);
(*env)->ReleaseStringChars(env, dir, (const jchar*) str);
}
}
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
flags = CREATE_NEW_CONSOLE;
flags |= CREATE_UNICODE_ENVIRONMENT;
ret = CreateProcessW(0, /* executable name */
@ -627,8 +573,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
&si, /* (in) startup information */
&pi); /* (out) process information */
if (NULL != cwd)
free(cwd);
if (NULL != szEnvBlock)
@ -640,36 +584,24 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
{
char *lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t *)&lpMsgBuf,
0,
NULL
);
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
LocalFree(lpMsgBuf);
ret = -1;
}
else
{
} else {
// Clean-up
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
ret = (long) pi.dwProcessId; //hProcess;
}
return ret;
}
/////////////////////////////////////////////////////////////////////////////////////
// Emulation of the signal raising
// Arguments: (see Spawner.java)
@ -679,9 +611,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
#ifdef __cplusplus
extern "C"
#endif
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
(JNIEnv * env, jobject process, jint uid, jint signal)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject process, jint uid,
jint signal) {
jint ret = 0;
HANDLE hProc;
@ -707,8 +638,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
if (NULL == hProc)
return -1;
switch(signal)
{
switch (signal) {
case SIG_NOOP:
// Wait 0 msec -just check if the process has been still running
ret = ((WAIT_TIMEOUT == WaitForSingleObject(hProc, 0)) ? 0 : -1);
@ -759,11 +689,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
CloseHandle(hProc);
return ret;
}
/////////////////////////////////////////////////////////////////////////////////////
// Wait for process termination
// Arguments: (see Spawner.java)
@ -772,9 +699,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
#ifdef __cplusplus
extern "C"
#endif
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
(JNIEnv * env, jobject process, jint uid)
{
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;
@ -790,23 +715,16 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
what = WaitForSingleObject(hProc, INFINITE);
if (what == WAIT_OBJECT_0)
{
if (what == WAIT_OBJECT_0) {
GetExitCodeProcess(hProc, &exit_code);
}
if (hProc)
CloseHandle(hProc);
return exit_code;
}
// Utilities
/////////////////////////////////////////////////////////////////////////////////////
@ -815,8 +733,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
// [in] name - name of exception class
// [in] message to assign thi event
/////////////////////////////////////////////////////////////////////////////////////
void ThrowByName(JNIEnv *env, const char *name, const char *msg)
{
void ThrowByName(JNIEnv *env, const char *name, const char *msg) {
jclass cls = (*env)->FindClass(env, name);
if (cls != 0) /* Otherwise an exception has already been thrown */
@ -826,31 +743,24 @@ void ThrowByName(JNIEnv *env, const char *name, const char *msg)
(*env)->DeleteLocalRef(env, cls);
}
/////////////////////////////////////////////////////////////////////////////////////
// Create process description block.
// Arguments: no
// Return : pointer to the process descriptor
/////////////////////////////////////////////////////////////////////////////////////
pProcInfo_t createProcInfo()
{
pProcInfo_t createProcInfo() {
int i;
pProcInfo_t p = NULL;
EnterCriticalSection(&cs);
if(NULL == pInfo)
{
if (NULL == pInfo) {
pInfo = (pProcInfo_t) malloc(sizeof(procInfo_t) * MAX_PROCS);
ZeroMemory(pInfo, sizeof(procInfo_t) * MAX_PROCS);
}
for(i = 0; i < MAX_PROCS; ++i)
{
if(pInfo[i].pid == 0)
{
for (i = 0; i < MAX_PROCS; ++i) {
if (pInfo[i].pid == 0) {
pInfo[i].pid = -1;
pInfo[i].uid = ++procCounter;
p = pInfo + i;
@ -868,17 +778,14 @@ pProcInfo_t createProcInfo()
// Arguments: no
// Return : pointer to the process descriptor
/////////////////////////////////////////////////////////////////////////////////////
pProcInfo_t findProcInfo(int uid)
{
pProcInfo_t findProcInfo(int uid) {
int i;
pProcInfo_t p = NULL;
if (NULL == pInfo)
return NULL;
for(i = 0; i < MAX_PROCS; ++i)
{
if(pInfo[i].uid == uid)
{
for (i = 0; i < MAX_PROCS; ++i) {
if (pInfo[i].uid == uid) {
p = pInfo + i;
break;
}
@ -892,32 +799,26 @@ pProcInfo_t findProcInfo(int uid)
// Arguments:
// pCurProcInfo - pointer to descriptor to clean up
// Return : no
void cleanUpProcBlock(pProcInfo_t pCurProcInfo)
{
if(0 != pCurProcInfo -> eventBreak)
{
void cleanUpProcBlock(pProcInfo_t pCurProcInfo) {
if (0 != pCurProcInfo->eventBreak) {
CloseHandle(pCurProcInfo->eventBreak);
pCurProcInfo->eventBreak = 0;
}
if(0 != pCurProcInfo -> eventWait)
{
if (0 != pCurProcInfo->eventWait) {
CloseHandle(pCurProcInfo->eventWait);
pCurProcInfo->eventWait = 0;
}
if(0 != pCurProcInfo -> eventTerminate)
{
if (0 != pCurProcInfo->eventTerminate) {
CloseHandle(pCurProcInfo->eventTerminate);
pCurProcInfo->eventTerminate = 0;
}
if(0 != pCurProcInfo -> eventKill)
{
if (0 != pCurProcInfo->eventKill) {
CloseHandle(pCurProcInfo->eventKill);
pCurProcInfo->eventKill = 0;
}
if(0 != pCurProcInfo -> eventCtrlc)
{
if (0 != pCurProcInfo->eventCtrlc) {
CloseHandle(pCurProcInfo->eventCtrlc);
pCurProcInfo->eventCtrlc = 0;
}
@ -968,8 +869,7 @@ void _cdecl waitProcTermination(void* pv)
// availSpace - size of the target buffer
// Return :number of bytes used in target, or -1 in case of error
/////////////////////////////////////////////////////////////////////////////////////
int copyTo(wchar_t * target, const wchar_t * source, int cpyLength, int availSpace)
{
int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace) {
BOOL bSlash = FALSE;
int i = 0, j = 0;
int totCpyLength = cpyLength;
@ -980,39 +880,28 @@ int copyTo(wchar_t * target, const wchar_t * source, int cpyLength, int availSpa
int nQuotationMode = 0;
if (availSpace <= cpyLength) // = to reserve space for final '\0'
return -1;
if((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1)))
{
if ((_T('\"') == *source) && (_T('\"') == *(source + cpyLength - 1))) {
nQuotationMode = QUOTATION_DONE;
}
else
if(wcschr(source, _T(' ')) == NULL)
{
} else if (wcschr(source, _T(' ')) == NULL) {
// No reason to quote term because it doesn't have embedded spaces
nQuotationMode = QUOTATION_NONE;
}
else
{
} else {
// Needs to be quoted
nQuotationMode = QUOTATION_DO;
*target = _T('\"');
++j;
}
for(; i < cpyLength; ++i, ++j)
{
for (; i < cpyLength; ++i, ++j) {
if (source[i] == _T('\\'))
bSlash = TRUE;
else
{
else {
// Don't escape embracing quotation marks
if((source[i] == _T('\"')) && !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))) ) )
{
if ((source[i] == _T('\"'))
&& !((nQuotationMode == QUOTATION_DONE) && ((i == 0) || (i == (cpyLength - 1))))) {
if (!bSlash) // If still not escaped
{
if (j == availSpace)
@ -1029,8 +918,7 @@ int copyTo(wchar_t * target, const wchar_t * source, int cpyLength, int availSpa
target[j] = source[i];
}
if(nQuotationMode == QUOTATION_DO)
{
if (nQuotationMode == QUOTATION_DO) {
if (j == availSpace)
return -1;
target[j] = _T('\"');

View file

@ -62,10 +62,7 @@ WINPTY_API winpty_t *winpty_open(int cols, int rows);
*
* Returns 0 on success or a Win32 error code on failure.
*/
WINPTY_API int winpty_start_process(winpty_t *pc,
const wchar_t *appname,
const wchar_t *cmdline,
const wchar_t *cwd,
WINPTY_API int winpty_start_process(winpty_t *pc, const wchar_t *appname, const wchar_t *cmdline, const wchar_t *cwd,
const wchar_t *env);
/*

View file

@ -29,8 +29,7 @@ void ThrowByName(JNIEnv *env, const char *name, const char *msg);
#define BUFF_SIZE (1024)
static HANDLE channelToHandle(JNIEnv * env, jobject channel)
{
static HANDLE channelToHandle(JNIEnv *env, jobject channel) {
if (channel == 0) {
ThrowByName(env, "java/io/IOException", "Invalid channel object");
return NULL;
@ -56,9 +55,8 @@ static HANDLE channelToHandle(JNIEnv * env, jobject channel)
#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,17 +73,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
if (NULL == overlapped.hEvent) {
char *lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t *) &lpMsgBuf,
0,
NULL
);
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
// Free the buffer.
@ -99,20 +89,16 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
#endif
#endif
while(len > nBuffOffset)
{
while (len > nBuffOffset) {
DWORD nNumberOfBytesToRead = min(len - nBuffOffset, BUFF_SIZE);
DWORD nNumberOfBytesRead;
if(0 == ReadFile(handle, tmpBuf, nNumberOfBytesToRead, &nNumberOfBytesRead, &overlapped ))
{
if (0 == ReadFile(handle, tmpBuf, nNumberOfBytesToRead, &nNumberOfBytesRead, &overlapped)) {
int err = GetLastError();
if(err == ERROR_IO_PENDING)
{
if (err == ERROR_IO_PENDING) {
// asynchronous i/o is still in progress
// check on the results of the asynchronous read
if(GetOverlappedResult(handle, &overlapped,
&nNumberOfBytesRead, TRUE))
if (GetOverlappedResult(handle, &overlapped, &nNumberOfBytesRead, TRUE))
err = 0;
// if there was a problem ...
else
@ -120,8 +106,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
}
if (err == ERROR_BROKEN_PIPE) // Pipe was closed
break;
if(err != 0)
{
if (err != 0) {
char *lpMsgBuf;
#ifdef DEBUG_MONITOR
_stprintf(buffer, _T("Read failed - %i, error %i\n"), fd, err);
@ -130,24 +115,15 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
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
);
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
LocalFree(lpMsgBuf);
nBuffOffset = 0;
break;
}
else
{
} else {
// buffer overflow?
// according to msdn this happens in message read mode only
#ifdef DEBUG_MONITOR
@ -166,12 +142,10 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
nBuffOffset += nNumberOfBytesRead;
if (nNumberOfBytesRead != nNumberOfBytesToRead)
break;
else
{
else {
// Is there data left in the pipe?
DWORD bytesAvailable = 0;
if (!PeekNamedPipe(handle, NULL, 0, NULL, &bytesAvailable, NULL)
|| bytesAvailable == 0)
if (!PeekNamedPipe(handle, NULL, 0, NULL, &bytesAvailable, NULL) || bytesAvailable == 0)
// No bytes left
break;
}
@ -190,9 +164,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
#ifdef __cplusplus
extern "C"
#endif
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
(JNIEnv * env, jobject proc, jobject channel)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv *env, jobject proc,
jobject channel) {
int rc;
HANDLE handle = channelToHandle(env, channel);
#ifdef DEBUG_MONITOR
@ -211,9 +184,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);
@ -227,32 +199,21 @@ 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);
while(len > nBuffOffset)
{
while (len > nBuffOffset) {
DWORD nNumberOfBytesToWrite = min(len - nBuffOffset, BUFF_SIZE);
DWORD nNumberOfBytesWritten;
(*env)->GetByteArrayRegion(env, buf, nBuffOffset, nNumberOfBytesToWrite, tmpBuf);
if(0 == WriteFile(handle, tmpBuf, nNumberOfBytesToWrite, &nNumberOfBytesWritten, NULL))
{
if (0 == WriteFile(handle, tmpBuf, nNumberOfBytesToWrite, &nNumberOfBytesWritten, NULL)) {
char *lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t *) &lpMsgBuf,
0,
NULL
);
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t*) &lpMsgBuf, 0, NULL);
ThrowByName(env, "java/io/IOException", lpMsgBuf);
LocalFree(lpMsgBuf);
@ -266,9 +227,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

@ -32,8 +32,7 @@ static std::map<int, int> fd2rc;
* Method: openMaster
* Signature: (Z)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *env, jobject jobj, jboolean console)
{
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *env, jobject jobj, jboolean console) {
jfieldID fid; /* Store the field ID */
jstring jstr = NULL;
jclass cls;
@ -88,8 +87,8 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
* Method: change_window_size
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(JNIEnv *env, jobject jobj, jint fdm, jint width, jint height)
{
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;
@ -109,9 +108,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size(J
* Method: read0
* Signature: (I[BI)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0
(JNIEnv *env, jobject jobj, jint jfd, jbyteArray buf, jint buf_len)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0(JNIEnv *env, jobject jobj, jint jfd,
jbyteArray buf, jint buf_len) {
DWORD amount = -1;
OVERLAPPED over;
int fd;
@ -167,8 +165,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIEnv *env, jobject jobj, jint jfd)
{
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;
@ -191,8 +188,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0(JNIE
* Method: write0
* Signature: (I[BI)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv *env, jobject jobj, jint jfd, jbyteArray buf, jint buf_len)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNIEnv *env, jobject jobj, jint jfd,
jbyteArray buf, jint buf_len) {
DWORD written = -1;
OVERLAPPED over;
int fd;
@ -235,8 +232,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0(JNI
* Method: close0
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNIEnv *env, jobject jobj, jint jfd)
{
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;
@ -257,8 +253,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0(JNI
/*
* Convert convert slashes to backslashes.
*/
static std::wstring convertSlashes(const wchar_t *path)
{
static std::wstring convertSlashes(const wchar_t *path) {
std::wstring ret;
for (int i = 0; path[i] != L'\0'; ++i) {
@ -273,17 +268,13 @@ static std::wstring convertSlashes(const wchar_t *path)
// Convert argc/argv into a Win32 command-line following the escaping convention
// documented on MSDN. (e.g. see CommandLineToArgvW documentation)
static std::wstring argvToCommandLine(const std::vector<std::wstring> &argv)
{
static std::wstring argvToCommandLine(const std::vector<std::wstring> &argv) {
std::wstring result;
for (size_t argIndex = 0; argIndex < argv.size(); ++argIndex) {
if (argIndex > 0)
result.push_back(L' ');
const wchar_t *arg = argv[argIndex].c_str();
const bool quote =
wcschr(arg, L' ') != NULL ||
wcschr(arg, L'\t') != NULL ||
*arg == L'\0';
const bool quote = wcschr(arg, L' ') != NULL || wcschr(arg, L'\t') != NULL || *arg == L'\0';
if (quote)
result.push_back(L'\"');
int bsCount = 0;
@ -315,9 +306,8 @@ static std::wstring argvToCommandLine(const std::vector<std::wstring> &argv)
* Method: exec2
* Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;IZ)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2
(JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jobjectArray jchannels, jstring jslaveName, jint masterFD, jboolean console)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2(JNIEnv *env, jobject jobj, jobjectArray jcmd,
jobjectArray jenv, jstring jdir, jobjectArray jchannels, jstring jslaveName, jint masterFD, jboolean console) {
int fd;
std::map<int, winpty_t*>::iterator fd2pty_Iter;
@ -343,8 +333,10 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2
for (i = 0; i < argc; i++) {
jstring j_str = (jstring) env->GetObjectArrayElement(jcmd, i);
const wchar_t *w_str = (const wchar_t*) env->GetStringChars(j_str, NULL);
if (i == 0) argVector.push_back(convertSlashes(w_str));
else argVector.push_back(w_str);
if (i == 0)
argVector.push_back(convertSlashes(w_str));
else
argVector.push_back(w_str);
env->ReleaseStringChars(j_str, (const jchar*) w_str);
env->DeleteLocalRef(j_str);
}
@ -363,11 +355,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2
std::wstring cmdLine = argvToCommandLine(argVector);
const wchar_t *cmdLineW = cmdLine.c_str();
int ret = winpty_start_process(winpty,
NULL,
cmdLineW,
cwdW,
envp.c_str());
int ret = winpty_start_process(winpty, NULL, cmdLineW, cwdW, envp.c_str());
if (ret == 0) {
// Success. Get the process id.
@ -376,8 +364,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2
}
}
bail_out:
env->ReleaseStringChars(jdir, (const jchar *) cwdW);
bail_out: env->ReleaseStringChars(jdir, (const jchar*) cwdW);
env->ReleaseStringUTFChars(jslaveName, pts_name);
return pid;
@ -388,9 +375,7 @@ bail_out:
* Method: waitFor
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor
(JNIEnv *env, jobject jobj, jint masterFD, jint pid)
{
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor(JNIEnv *env, jobject jobj, jint masterFD, jint pid) {
int status = -1;
DWORD flags;
@ -407,7 +392,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor
BOOL success;
do {
success = GetHandleInformation(handle, &flags);
if (success) Sleep(500);
if (success)
Sleep(500);
} while (success);
fd2rc_Iter = fd2rc.find(fd);

View file

@ -5,13 +5,8 @@
#pragma comment(lib, "delayimp")
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
@ -21,30 +16,22 @@ BOOL APIENTRY DllMain( HMODULE hModule,
return TRUE;
}
static HMODULE getCurrentModule()
{
static HMODULE getCurrentModule() {
HMODULE module;
if (!GetModuleHandleEx(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCTSTR)getCurrentModule,
&module)) {
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCTSTR) getCurrentModule, &module)) {
assert(false);
}
return module;
}
HMODULE PTYExplicitLoadLibrary( LPCSTR pszModuleName )
{
if( lstrcmpiA( pszModuleName, "winpty.dll" ) == 0 )
{
HMODULE PTYExplicitLoadLibrary(LPCSTR pszModuleName) {
if (lstrcmpiA(pszModuleName, "winpty.dll") == 0) {
CHAR szPath[MAX_PATH] = "";
//_hdllInstance is the HMODULE of *this* module
DWORD cchPath = GetModuleFileNameA(getCurrentModule(), szPath, MAX_PATH);
while( cchPath > 0 )
{
switch( szPath[cchPath - 1] )
{
while (cchPath > 0) {
switch (szPath[cchPath - 1]) {
case '\\':
case '/':
case ':':
@ -61,8 +48,7 @@ HMODULE PTYExplicitLoadLibrary( LPCSTR pszModuleName )
return NULL;
}
FARPROC WINAPI PTYDliNotifyHook( unsigned dliNotify, PDelayLoadInfo pdli )
{
FARPROC WINAPI PTYDliNotifyHook(unsigned dliNotify, PDelayLoadInfo pdli) {
if (dliNotify == dliNotePreLoadLibrary)
return (FARPROC) PTYExplicitLoadLibrary(pdli->szDll);
return NULL;

View file

@ -22,10 +22,8 @@
extern void JNICALL ThrowByName(JNIEnv *env, const char *name, const char *msg);
static HWND consoleHWND;
/////////////////////////////////////////////////////////////////////////////////////
// Check if window is a console of process with pid
// Arguments:
@ -34,20 +32,17 @@ static HWND consoleHWND;
// Return : TRUE if yes
/////////////////////////////////////////////////////////////////////////////////////
static BOOL CALLBACK
find_child_console (HWND hwnd, LPARAM arg)
{
find_child_console(HWND hwnd, LPARAM arg) {
DWORD thread_id;
DWORD process_id;
DWORD pid = arg;
thread_id = GetWindowThreadProcessId(hwnd, &process_id);
if (process_id == pid)
{
if (process_id == pid) {
wchar_t window_class[32];
GetClassName(hwnd, window_class, sizeof(window_class));
if (wcscmp (window_class, L"ConsoleWindowClass") == 0)
{
if (wcscmp(window_class, L"ConsoleWindowClass") == 0) {
consoleHWND = hwnd;
return FALSE;
}
@ -60,7 +55,8 @@ 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
/////////////////////////////////////////////////////////////////////////////////////
@ -76,20 +72,17 @@ typedef BOOL (WINAPI *DebugBreakProcessFunc)(HANDLE);
// pid - process' pid
// Return : 0 if OK or error code
/////////////////////////////////////////////////////////////////////////////////////
int interruptProcess(int pid)
{
int interruptProcess(int pid) {
// See if DebugBreakProcess is available (XP and beyond)
HMODULE hmod = LoadLibrary(L"Kernel32.dll");
if (hmod != NULL)
{
if (hmod != NULL) {
BOOL success = FALSE;
FARPROC procaddr = GetProcAddress(hmod, "DebugBreakProcess");
if (procaddr != NULL)
{
if (procaddr != NULL) {
HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD) pid);
if (proc != NULL)
{
typedef BOOL WINAPI (*DebugBreakProcessFunc)(HANDLE);
if (proc != NULL) {
typedef BOOL WINAPI( *DebugBreakProcessFunc)
(HANDLE);
DebugBreakProcessFunc pDebugBreakProcess = (DebugBreakProcessFunc) procaddr;
success = (*pDebugBreakProcess)(proc);
CloseHandle(proc);
@ -127,10 +120,8 @@ int interruptProcess(int pid)
BYTE break_scan_code = (BYTE) MapVirtualKey(vk_break_code, 0);
HWND foreground_window;
foreground_window = GetForegroundWindow();
if (foreground_window)
{
if (foreground_window) {
/* NT 5.0, and apparently also Windows 98, will not allow
a Window to be set to foreground directly without the
user's involvement. The workaround is to attach
@ -138,28 +129,22 @@ int interruptProcess(int pid)
window, since that is the only thread that can set the
foreground window. */
DWORD foreground_thread, child_thread;
foreground_thread =
GetWindowThreadProcessId (foreground_window, NULL);
foreground_thread = GetWindowThreadProcessId(foreground_window, NULL);
if (foreground_thread == GetCurrentThreadId()
|| !AttachThreadInput (GetCurrentThreadId (),
foreground_thread, TRUE))
|| !AttachThreadInput(GetCurrentThreadId(), foreground_thread, TRUE))
foreground_thread = 0;
child_thread = GetWindowThreadProcessId(consoleHWND, NULL);
if (child_thread == GetCurrentThreadId ()
|| !AttachThreadInput (GetCurrentThreadId (),
child_thread, TRUE))
if (child_thread == GetCurrentThreadId() || !AttachThreadInput(GetCurrentThreadId(), child_thread, TRUE))
child_thread = 0;
/* Set the foreground window to the child. */
if (SetForegroundWindow (consoleHWND))
{
if (SetForegroundWindow(consoleHWND)) {
if (0 != break_scan_code) {
/* Generate keystrokes as if user had typed Ctrl-Break */
keybd_event(VK_CONTROL, control_scan_code, 0, 0);
keybd_event(vk_break_code, break_scan_code, KEYEVENTF_EXTENDEDKEY, 0);
keybd_event (vk_break_code, break_scan_code,
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
keybd_event(vk_break_code, break_scan_code, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, control_scan_code, KEYEVENTF_KEYUP, 0);
}
@ -171,11 +156,9 @@ int interruptProcess(int pid)
/* Detach from the foreground and child threads now that
the foreground switching is over. */
if (foreground_thread)
AttachThreadInput (GetCurrentThreadId (),
foreground_thread, FALSE);
AttachThreadInput(GetCurrentThreadId(), foreground_thread, FALSE);
if (child_thread)
AttachThreadInput (GetCurrentThreadId (),
child_thread, FALSE);
AttachThreadInput(GetCurrentThreadId(), child_thread, FALSE);
#ifdef DEBUG_MONITOR
_stprintf(buffer, _T("Sent Ctrl-C & Ctrl-Break to process %i\n"), pid);
OutputDebugStringW(buffer);

View file

@ -23,21 +23,14 @@
CRITICAL_SECTION cs;
wchar_t path[MAX_PATH + 1] = { _T('\0') }; // Directory where spawner.dll is located
#if __cplusplus
extern "C"
#endif
BOOL APIENTRY DllMain( HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH: {
wchar_t *p;
InitializeCriticalSection(&cs);
GetModuleFileNameW(hModule, path, MAX_PATH);

View file

@ -30,8 +30,7 @@
#define MAX_CMD_LINE_LENGTH (2049)
#define PIPE_NAME_LENGTH 100
int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
int availSpace);
int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace);
void DisplayErrorMessage();
//BOOL KillProcessEx(DWORD dwProcessId); // Handle of the process
@ -40,8 +39,7 @@ void DisplayErrorMessage();
BOOL WINAPI HandlerRoutine(DWORD dwCtrlType) // control signal type
{
BOOL ret = TRUE;
switch(dwCtrlType)
{
switch (dwCtrlType) {
case CTRL_C_EVENT:
break;
case CTRL_BREAK_EVENT:
@ -144,8 +142,7 @@ int main() {
// Make sure that we've been passed the right number of arguments
if (argc < 8) {
_tprintf(_T("Usage: %s (four inheritable event handles) (CommandLineToSpawn)\n"),
argv[0]);
_tprintf(_T("Usage: %s (four inheritable event handles) (CommandLineToSpawn)\n"), argv[0]);
return (0);
}
@ -155,8 +152,7 @@ int main() {
szCmdLine[0] = 0;
int nPos = 0;
for(int i = 8; i < argc; ++i)
{
for (int i = 8; i < argc; ++i) {
int nCpyLen;
int len = wcslen(argv[i]);
int requiredSize = nPos + len + 2;
@ -173,8 +169,7 @@ int main() {
#endif
return 0;
}
if(0 > (nCpyLen = copyTo(szCmdLine + nPos, argv[i], len, nCmdLineLength - nPos)))
{
if (0 > (nCpyLen = copyTo(szCmdLine + nPos, argv[i], len, nCmdLineLength - nPos))) {
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Not enough space to build command line\n"));
#endif
@ -211,9 +206,12 @@ int main() {
wchar_t outPipeName[PIPE_NAME_LENGTH];
wchar_t errPipeName[PIPE_NAME_LENGTH];
swprintf(inPipeName, sizeof(inPipeName)/sizeof(inPipeName[0]), L"\\\\.\\pipe\\stdin%08i%010i", parentPid, nCounter);
swprintf(outPipeName, sizeof(outPipeName)/sizeof(outPipeName[0]), L"\\\\.\\pipe\\stdout%08i%010i", parentPid, nCounter);
swprintf(errPipeName, sizeof(errPipeName)/sizeof(errPipeName[0]), L"\\\\.\\pipe\\stderr%08i%010i", parentPid, nCounter);
swprintf(inPipeName, sizeof(inPipeName) / sizeof(inPipeName[0]), L"\\\\.\\pipe\\stdin%08i%010i", parentPid,
nCounter);
swprintf(outPipeName, sizeof(outPipeName) / sizeof(outPipeName[0]), L"\\\\.\\pipe\\stdout%08i%010i", parentPid,
nCounter);
swprintf(errPipeName, sizeof(errPipeName) / sizeof(errPipeName[0]), L"\\\\.\\pipe\\stderr%08i%010i", parentPid,
nCounter);
#ifdef DEBUG_MONITOR
swprintf(buffer, _T("Pipes: %s, %s, %s\n"), inPipeName, outPipeName, errPipeName);
OutputDebugStringW(buffer);
@ -226,10 +224,14 @@ int main() {
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
if((INVALID_HANDLE_VALUE == (stdHandles[0] = CreateFileW(inPipeName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, &sa))) ||
(INVALID_HANDLE_VALUE == (stdHandles[1] = CreateFileW(outPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))) ||
(INVALID_HANDLE_VALUE == (stdHandles[2] = CreateFileW(errPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, &sa))))
{
if ((INVALID_HANDLE_VALUE
== (stdHandles[0] = CreateFileW(inPipeName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, &sa)))
|| (INVALID_HANDLE_VALUE
== (stdHandles[1] = CreateFileW(outPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
0, &sa)))
|| (INVALID_HANDLE_VALUE
== (stdHandles[2] = CreateFileW(errPipeName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
0, &sa)))) {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Failed to open pipe %i, %i, %i: %i\n"), stdHandles[0], stdHandles[1], stdHandles[2], GetLastError());
OutputDebugStringW(buffer);
@ -243,9 +245,8 @@ int main() {
SetHandleInformation(stdHandles[1], HANDLE_FLAG_INHERIT, TRUE);
SetHandleInformation(stdHandles[2], HANDLE_FLAG_INHERIT, TRUE);
if(!SetStdHandle(STD_INPUT_HANDLE, stdHandles[0]) ||
!SetStdHandle(STD_OUTPUT_HANDLE, stdHandles[1]) ||
!SetStdHandle(STD_ERROR_HANDLE, stdHandles[2])) {
if (!SetStdHandle(STD_INPUT_HANDLE, stdHandles[0]) || !SetStdHandle(STD_OUTPUT_HANDLE, stdHandles[1])
|| !SetStdHandle(STD_ERROR_HANDLE, stdHandles[2])) {
#ifdef DEBUG_MONITOR
swprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), _T("Failed to reassign standard streams: %i\n"), GetLastError());
OutputDebugStringW(buffer);
@ -304,12 +305,10 @@ int main() {
// If this process is already part of a job, the flag CREATE_BREAKAWAY_FROM_JOB
// makes the child process detach from the job, such that we can assign it
// to our own job object.
BOOL f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE,
CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi);
BOOL f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi);
// If breaking away from job is not permitted, retry without breakaway flag
if (!f)
f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE,
0, NULL, NULL, &si, &pi);
f = CreateProcessW(NULL, szCmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
// We don't need them any more
CloseHandle(stdHandles[0]);
@ -335,13 +334,11 @@ int main() {
}
}
while(!exitProc)
{
while (!exitProc) {
// Wait for the spawned-process to die or for the event
// indicating that the processes should be forcibly killed.
DWORD event = WaitForMultipleObjects(5, h, FALSE, INFINITE);
switch (event)
{
switch (event) {
case WAIT_OBJECT_0 + 0: // SIGINT
case WAIT_OBJECT_0 + 4: // CTRL-C
#ifdef DEBUG_MONITOR
@ -432,8 +429,7 @@ int main() {
#endif
}
if (NULL != szCmdLine)
{
if (NULL != szCmdLine) {
free(szCmdLine);
}
@ -456,8 +452,7 @@ int main() {
// availSpace - size of the target buffer
// Return :number of bytes used in target, or -1 in case of error
/////////////////////////////////////////////////////////////////////////////////////
int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
int availSpace) {
int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace) {
BOOL bSlash = FALSE;
int i = 0, j = 0;
int totCpyLength = cpyLength;
@ -515,9 +510,8 @@ int copyTo(wchar_t * target, const wchar_t * source, int cpyLength,
void DisplayErrorMessage() {
wchar_t *lpMsgBuf;
FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(wchar_t*) &lpMsgBuf, 0, NULL);
OutputDebugStringW(lpMsgBuf);
// Free the buffer.

View file

@ -23,7 +23,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>6.0.0-SNAPSHOT</version>
<version>6.0.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.native</artifactId>
<packaging>eclipse-plugin</packaging>

View file

@ -1,5 +1,192 @@
#Wed Jun 06 11:37:01 EDT 2007
eclipse.preferences.version=1
indexer/indexerId=org.eclipse.cdt.core.nullindexer
indexerId=org.eclipse.cdt.core.nullindexer
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
org.eclipse.cdt.core.formatter.alignment_for_member_access=0
org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
org.eclipse.cdt.core.formatter.compact_else_if=true
org.eclipse.cdt.core.formatter.continuation_indentation=2
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.cdt.core.formatter.format_block_comment=true
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.cdt.core.formatter.format_header_comment=true
org.eclipse.cdt.core.formatter.format_line_comment=true
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
org.eclipse.cdt.core.formatter.indent_empty_lines=false
org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.cdt.core.formatter.indentation.size=4
org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.join_wrapped_lines=true
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.cdt.core.formatter.lineSplit=120
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.cdt.core.formatter.tabulation.char=tab
org.eclipse.cdt.core.formatter.tabulation.size=4
org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false

View file

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

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName.win32.x86_64
Bundle-SymbolicName: org.eclipse.cdt.core.win32.x86_64;singleton:=true
Bundle-Version: 6.0.0.qualifier
Bundle-Version: 6.0.100.qualifier
Fragment-Host: org.eclipse.cdt.core.native;bundle-version="[6.0.0,7.0.0)"
Eclipse-PlatformFilter: (&(osgi.os=win32)(osgi.arch=x86_64))
Bundle-Vendor: %providerName

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>6.0.0-SNAPSHOT</version>
<version>6.0.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.win32.x86_64</artifactId>
<packaging>eclipse-plugin</packaging>

View file

@ -35,5 +35,6 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,189 @@
eclipse.preferences.version=1
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
org.eclipse.cdt.core.formatter.alignment_for_member_access=0
org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
org.eclipse.cdt.core.formatter.compact_else_if=true
org.eclipse.cdt.core.formatter.continuation_indentation=2
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.cdt.core.formatter.format_block_comment=true
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.cdt.core.formatter.format_header_comment=true
org.eclipse.cdt.core.formatter.format_line_comment=true
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
org.eclipse.cdt.core.formatter.indent_empty_lines=false
org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.cdt.core.formatter.indentation.size=4
org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.join_wrapped_lines=true
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.cdt.core.formatter.lineSplit=120
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.cdt.core.formatter.tabulation.char=tab
org.eclipse.cdt.core.formatter.tabulation.size=4
org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false

View file

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

View file

@ -30,5 +30,6 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,189 @@
eclipse.preferences.version=1
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.cdt.core.formatter.alignment_for_lambda_expression=20
org.eclipse.cdt.core.formatter.alignment_for_member_access=0
org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_linkage_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column=false
org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
org.eclipse.cdt.core.formatter.comment_formatter_off_tag=@formatter\:off
org.eclipse.cdt.core.formatter.comment_formatter_on_tag=@formatter\:on
org.eclipse.cdt.core.formatter.compact_else_if=true
org.eclipse.cdt.core.formatter.continuation_indentation=2
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.cdt.core.formatter.format_block_comment=true
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.cdt.core.formatter.format_header_comment=true
org.eclipse.cdt.core.formatter.format_line_comment=true
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_linkage=false
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
org.eclipse.cdt.core.formatter.indent_empty_lines=false
org.eclipse.cdt.core.formatter.indent_label_compare_to_statements=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.cdt.core.formatter.indentation.size=4
org.eclipse.cdt.core.formatter.insert_new_line_after_colon_in_constructor_initializer_list=insert
org.eclipse.cdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
org.eclipse.cdt.core.formatter.insert_space_after_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_structured_binding_name_list=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_lambda_return=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_linkage_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_structured_binding_name_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list=insert
org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.cdt.core.formatter.insert_space_before_ref_qualifier_in_structured_binding=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.join_wrapped_lines=true
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.cdt.core.formatter.lineSplit=120
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.cdt.core.formatter.tabulation.char=tab
org.eclipse.cdt.core.formatter.tabulation.size=4
org.eclipse.cdt.core.formatter.use_comment_formatter_tag=true
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false

View file

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

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.native.serial
Bundle-Version: 1.2.0.qualifier
Bundle-Version: 1.2.100.qualifier
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.cdt.serial

View file

@ -63,8 +63,7 @@ static void closeAndthrowIOException(HANDLE handle, JNIEnv *env, const char *msg
(*env)->ThrowNew(env, cls, buff);
}
static void throwIOException(JNIEnv *env, const char *msg)
{
static void throwIOException(JNIEnv *env, const char *msg) {
char buff[256];
#ifndef __MINGW32__
sprintf(buff, "%s: %s", msg, strerror(errno));
@ -75,8 +74,8 @@ static void throwIOException(JNIEnv *env, const char *msg)
(*env)->ThrowNew(env, cls, buff);
}
JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName, jint baudRate, jint byteSize, jint parity, jint stopBits)
{
JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName, jint baudRate, jint byteSize,
jint parity, jint stopBits) {
#ifndef __MINGW32__
const char *cportName = (*env)->GetStringUTFChars(env, portName, NULL);
int fd = open(cportName, O_RDWR | O_NOCTTY | O_NDELAY);
@ -342,7 +341,8 @@ JNIEXPORT jlong JNICALL FUNC(open0)(JNIEnv *env, jobject jobj, jstring portName,
#endif // __MINGW32__
}
JNIEXPORT void JNICALL FUNC(close0)(JNIEnv *env, jobject jobj, jlong handle)
JNIEXPORT void JNICALL FUNC(close0)
(JNIEnv *env, jobject jobj, jlong handle)
{
#ifndef __MINGW32__
close(handle);
@ -355,8 +355,7 @@ JNIEXPORT void JNICALL FUNC(close0)(JNIEnv *env, jobject jobj, jlong handle)
#endif
}
JNIEXPORT jint JNICALL FUNC(available0)(JNIEnv * env, jobject jobj, jlong jhandle)
{
JNIEXPORT jint JNICALL FUNC(available0)(JNIEnv *env, jobject jobj, jlong jhandle) {
#ifndef __MINGW32__
int result = 0;
if (ioctl(jhandle, FIONREAD, &result) < 0) {
@ -381,8 +380,7 @@ JNIEXPORT jint JNICALL FUNC(available0)(JNIEnv * env, jobject jobj, jlong jhandl
#endif
}
JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv * env, jobject jobj, jlong jhandle, jbyteArray bytes, jint offset, jint size)
{
JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv *env, jobject jobj, jlong jhandle, jbyteArray bytes, jint offset, jint size) {
#ifndef __MINGW32__
jbyte buff[256];
int n = size < sizeof(buff) ? size : sizeof(buff);
@ -436,7 +434,8 @@ JNIEXPORT jint JNICALL FUNC(read1)(JNIEnv * env, jobject jobj, jlong jhandle, jb
#endif
}
JNIEXPORT void JNICALL FUNC(write0)(JNIEnv *env, jobject jobj, jlong jhandle, jint b)
JNIEXPORT void JNICALL FUNC(write0)
(JNIEnv *env, jobject jobj, jlong jhandle, jint b)
{
#ifndef __MINGW32__
char buff = b;

View file

@ -23,7 +23,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.100-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.native.serial</artifactId>
<packaging>eclipse-plugin</packaging>

View file

@ -88,6 +88,24 @@ git ls-files -- \*\*/.project ":!$COREPROJECT/.project" | while read i ; do
else
rm -f $d/.settings/org.eclipse.pde*.prefs
fi
# CDT (native code)
if [[ $natures == *"org.eclipse.cdt.core.cnature"* ]]; then
cp $COREPROJECT/.settings/org.eclipse.cdt.*.prefs $d/.settings
if echo $i | grep -E '\.tests?[/\.]' > /dev/null; then
# Disable indexer for test plugins
sed -i '
/^eclipse.preferences.version/ {
p # Print line
i indexer/indexerId=org.eclipse.cdt.core.nullindexer
i indexerId=org.eclipse.cdt.core.nullindexer
i instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
d # Already printed
}' $d/.settings/org.eclipse.cdt.core.prefs
fi
else
rm -f $d/.settings/org.eclipse.cdt.*.prefs
fi
done
##

View file

@ -23,6 +23,15 @@ for p in native/org.eclipse.cdt.native.serial core/org.eclipse.cdt.core.native;
exit 1
fi
# Disabled until https://bugs.eclipse.org/bugs/show_bug.cgi?id=568137 is resolved
# # Need to apply format after header files are generated
# tmpws=$(mktemp -d)
# ${ECLIPSE:-~/buildtools/eclipse-cpp-2020-09/eclipse} \
# -consolelog -nosplash -application org.eclipse.cdt.core.CodeFormatter \
# -config $p/.settings/org.eclipse.cdt.core.prefs \
# $p/native_src -verbose -data $tmpws
# rm -rf $tmpws
echo "Rebuilding $p natives to make sure they match source"
logfile=make-natives-${p//\//-}.log
if ! make -C $p/native_src rebuild >${logfile} 2>&1; then