Skip to content
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

Issue 11 print to outputstream #12

Closed

Conversation

bertysentry
Copy link
Collaborator

This may conflict with other Pull Requests. If you merge other Pull Request before, I'll have to rebase, but it's okay ;-)

@bertysentry
Copy link
Collaborator Author

Updated to remove conflicts

@eyalroth
Copy link
Collaborator

eyalroth commented Feb 3, 2018

I hope to get this reviewed next week, I'm just looking to finish up a small re-factor with the compiler first.

This might be annoying but could you perhaps change the PR so only the actual changes are recorded and not all the tab / spaces changes? (I believe the original code uses tabs and not spaces)

@bertysentry
Copy link
Collaborator Author

bertysentry commented Feb 4, 2018

Hi @eyalroth
I'm very sorry, I just realized how much AwkCompilerImpl.java is screwed up. I don't understand why Github is showing it this way. Even the import ... lines (which don't have spaces or tabs indentation) are marked as different! This is weird...
Besides, I'm more of a tab guy than a space guy... ;-)
I edited everything in Eclipse, which doesn't change spaces and tabs.
Anyway, I actually had no significant changes in AwkCompilerImpl.java.

Just:

  • fixed what Eclipse told me to (prefer Class<?> than just Class and similar issues)
  • re-implemented your own PR (before you merged it a few days ago)
  • added a return cg.getJavaClass().getBytes() at the end of the compile(AwkTuples) method, so the caller can do whatever he wants with the bytecode (including loading it directly, without going through a .JAR file)

None of this is really important and can therefore be safely discarded :-)

(edited after realizing my mistake with AwkCompilerImpl.java)

bertysentry referenced this pull request in sentrysoftware/Jawk Feb 6, 2018
* Fixed the handling of large integers
* Fixed the handling of uninitialized variables
* Fixed the sprintf() function (and related) to behave like GNU AWK (gawk)
Copy link
Collaborator

@eyalroth eyalroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all in favor of adding small re-factoring of small pieces of code while working on a feature / bug (I do it all the time), but I feel it is important to separate these changes from the actual functionality changes as much as possible. Obviously, if a re-factor is in place for the sake of adding / fixing functionality then it should be part of those changes, but if it is unrelated then I would say it should be committed separately (could be in the same PR though). Do you agree?

For the PR itself, there are a few changes missing here in order to fully support the issue:

  1. At Main.java:37 there is the option of starting a script with an alternate output stream - I would expect this to go over to the AwkSetting instance used there instead of changing the entire System.out. I would say that the same should actually be done with System.in, but perhaps that's not part of this PR. In addition, in the same "flow", there is the parsing of the settings from the input, and in case it was requested, the usage of the program will be printed to System.out (AwkParameters.java:169) - again, I would expect it to be printed directly to the custom output stream.
  2. Both jrtSystem and jrtSpawnForOutput methods inside of JRT.java pipe the stdout of a spawned process to the System.out, where it should probably pipe it to the output configured in the settings instead.
  3. The compiler mode still doesn't support the custom output stream correctly. If I'm not mistaken it even has a bug (regardless of this PR). You want me to add the proper handling there or you wanna give it a try (I'll explain the problem if needs be)?
  4. (optional) It is possible to add a custom error stream as well, but really isn't all that important.

P.S.
I would leave the changes to the return type of the compile method aside for this PR; I'm intending to change the compiler a bit in my own PR in a way that would make this irrelevant (only good stuff I promise).

@@ -1612,7 +1612,7 @@ public void interpret(AwkTuples tuples)
// stack[1] = second actual parameter
// etc.
Address func_addr = position.addressArg();
String func_name = position.arg(1).toString();
//String func_name = position.arg(1).toString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it that we delete code that we don't want to be used anymore and not just comment it out :)

@cdrasmussen
Copy link

cdrasmussen commented Apr 8, 2018 via email

@bertysentry
Copy link
Collaborator Author

Hi @cdrasmussen

I'm very sorry to hear about your health problems. I hope you'll get better soon!

I'd be happy to handle the maintenance of Jawk. As he was involved in Jawk maintenance too, maybe @eyalroth would like to handle that. @eyalroth ?

Thanks,
-- Bertrand

bertysentry referenced this pull request in sentrysoftware/Jawk Apr 12, 2018
…g-int to master

* commit 'b5a9ffa0ade0d3dfb88eef0e38b7b660e13affca':
  Fixed an issue with sprintf("%g") which does not behave the same way in Java and in C (and therefore in AWK)
  issue #12
  Added support for arbitrary *PrintStream* output (instead of System.out)
  Improved .gitignore
@hoijui
Copy link
Owner

hoijui commented Apr 27, 2018

i am a bit confused.. eyalroth is already the maintainer since some months now.
if someone is unhappy for not getting commits into the repo due to lazy or too restrictive maintainer(s) (what aeh.. whom you all looking at?!!), ask for maintainer permissions. :-)
to me he seems like eyalroth is doing a very good job at the moment.

@bertysentry bertysentry deleted the issue-11-print-to-outputstream branch July 20, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants