-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
requested changes to java.c, configure.ac, and internal state to cobl… #150
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e4b6f10
requested changes to java.c, configure.ac, and internal state to cobl…
xevor11 35f3ff4
Requested changes in PR #149, added modifications to CHANGELOG and DE…
xevor11 1409cdf
Formatted Changes to PR
xevor11 10761c7
Added changes to java.c for adding types and data structures for bidi…
xevor11 1ef39f0
Refactoring for generating static methods
xevor11 e2722fc
More Changes
xevor11 2f20dea
Small Fix
xevor11 3b5d860
Reverted all prior changes and cleaned up java.c
xevor11 52c90d6
Duplicate Methods
xevor11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,8 @@ static struct literal_list *literal_cache = NULL; | |
static struct field_list *field_cache = NULL; | ||
static struct field_list *local_field_cache = NULL; | ||
static struct call_list *call_cache = NULL; | ||
extern JavaVM *jvm; | ||
extern JNIEnv *env; | ||
static struct call_list *func_call_cache = NULL; | ||
static struct static_call_list *static_call_cache = NULL; | ||
static struct base_list *base_cache = NULL; | ||
|
@@ -387,6 +389,21 @@ lookup_source (const char *p) | |
return source_id++; | ||
} | ||
|
||
static void lookup_java_call(const char *p) { | ||
struct call_list *clp; | ||
|
||
for (clp = call_cache; clp; clp = clp->next) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's another list you need to manipulate in this function. Something like |
||
if (strcmp(p, clp->call_name) == 0) { | ||
return; | ||
} | ||
} | ||
|
||
clp = (struct call_list *)cob_malloc(sizeof(struct call_list)); | ||
clp->call_name = p; | ||
clp->next = call_cache; | ||
call_cache = clp; | ||
} | ||
|
||
static void | ||
lookup_call (const char *p) | ||
{ | ||
|
@@ -7529,38 +7546,42 @@ output_call (struct cb_call *p) | |
} | ||
} else { | ||
/* Dynamic link */ | ||
if(module_type == COB_MODULE_TYPE_FUNCTION && strmcmp ("Java.", s, 6) == 0) { | ||
(void*)func = cob_lookup_static_java_method(s + 6); /* <- java.c, declared in coblocal.h */ | ||
if(func != NULL) { | ||
insert(name, func, NULL, NULL, NULL, 1); | ||
resolve_error = NULL; | ||
return func; | ||
} | ||
} | ||
if (name_is_literal_or_prototype) { | ||
s = get_program_id_str (p->name); | ||
name_str = cb_encode_program_id (s, 1, cb_fold_call); | ||
lookup_call (name_str); | ||
callname = s; | ||
#ifdef HAVE_JNI | ||
/* Distinguishing lookup from call*/ | ||
if(strncmp("Java.", name, 6) == 0) { | ||
void static_java_method = lookup_static_call(s + 6, p->argv[0], COB_RETURN_NULL); | ||
cob_call_java(static_java_method); | ||
} else { | ||
// rest | ||
#endif | ||
// we need to use lookup_java_call instead (implement) | ||
lookup_java_call (name_str); | ||
callname = s; | ||
|
||
output_line ("if (call_%s.funcvoid == NULL || cob_glob_ptr->cob_physical_cancel)", name_str); | ||
output_block_open (); | ||
output_prefix (); | ||
output_line ("if (call_%s.funcvoid == NULL || cob_glob_ptr->cob_physical_cancel)", name_str); | ||
output_block_open (); | ||
output_prefix (); | ||
|
||
nlp = find_nested_prog_with_id (name_str); | ||
if (nlp) { | ||
output ("call_%s.funcint = %s_%d__;", | ||
name_str, name_str, | ||
nlp->nested_prog->toplev_count); | ||
} else { | ||
output ("call_%s.funcvoid = ", name_str); | ||
output ("cob_resolve_cobol ("); | ||
output_string ((const unsigned char *)s, | ||
(int)strlen (s), 0); | ||
output (", %d, %d);", cb_fold_call, !p->stmt1); | ||
nlp = find_nested_prog_with_id (name_str); | ||
if (nlp) { | ||
output ("call_%s.funcint = %s_%d__;", | ||
name_str, name_str, | ||
nlp->nested_prog->toplev_count); | ||
} else { | ||
output ("call_%s.funcvoid = ", name_str); | ||
output ("cob_resolve_cobol ("); | ||
output_string ((const unsigned char *)s, | ||
(int)strlen (s), 0); | ||
output (", %d, %d);", cb_fold_call, !p->stmt1); | ||
} | ||
output_newline (); | ||
output_block_close (); | ||
#ifdef HAVE_JNI | ||
} | ||
output_newline (); | ||
output_block_close (); | ||
#endif | ||
} else { | ||
name_str = NULL; | ||
needs_unifunc = 1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure these are needed in the compiler (
cobc
) itself.