8000 JACOBIN-466 : use Go os files for stdin, stdout, and stderr by texadactyl · Pull Request #132 · platypusguy/jacobin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JACOBIN-466 : use Go os files for stdin, stdout, and stderr #132

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

Merged
merged 9 commits into from
Feb 28, 2024
Merged

JACOBIN-466 : use Go os files for stdin, stdout, and stderr #132

merged 9 commits into from
Feb 28, 2024

Conversation

texadactyl
Copy link
Collaborator
@texadactyl texadactyl commented Feb 26, 2024

Impacted files:

  • gfunction/gfunction.go - loadlib(MTable, Load_Io_Console())
  • gfunction/javaIoPrintStream.go - implemented params[0] = Go I/O stream for output
  • gfunction/javaIoConsole.go - implemented params[0] = Go I/O stream for console I/O
  • gfunction/javaLangString.go - The format string might be a []byte instead of a *object.Object
  • gfunction/javaLangString_test.go - Minor change to test expectations
  • gfunction/javaLangSystem.go - add to statics
  • jvm/run.go - type possibility needs to include *os.File as well as *object.Object
  • statics/statics.go - comments only
  • go.mod - For password entry in class Console, go support requires golang.org/x/term
  • go.sum - ditto

@texadactyl
Copy link
Collaborator Author

jacotest still W-L 50-62

@texadactyl texadactyl changed the title JACOBIN-466 : use Go os files for stdin and stderr JACOBIN-466 : use Go os files for stdin, stdout, and stderr Feb 26, 2024
@texadactyl
Copy link
Collaborator Author

For password entry, I went this route:

package main
import (
    "fmt"
    "os"
    "syscall"
    "golang.org/x/term"
)
func main() {
    fmt.Print("Password: ")
    bytepw, err := term.ReadPassword(int(syscall.Stdin))
    if err != nil {
        Ouchie!
    }
    pass := string(bytepw)
    fmt.Printf("\nYou entered: %s\n", pass)
}

@texadactyl
Copy link
Collaborator Author
texadactyl commented Feb 26, 2024

These Console functions are supported:

  • void flush() Flushes the console and forces any buffered output to be written immediately .
  • Console format(String fmt, Object... args) Writes a formatted string to this console's output stream using the specified format string and arguments.
  • Console printf(String format, Object... args) Same as format.
  • String readLine() Reads a single line of text from the console.
  • String readLine(String fmt, Object... args) Provides a formatted prompt, then reads a single line of text from the console.
  • char[] readPassword() Reads a password or passphrase from the console with echoing disabled
  • char[] readPassword(String fmt, Object... args) Provides a formatted prompt, then reads a password or passphrase from the console with echoing disabled.

The following are not yet supported and generate exceptions:

  • Charset charset() Returns the Charset object used for the Console.
  • Reader reader() Retrieves the unique Reader object associated with this console.
  • PrintWriter writer() Retrieves the unique PrintWriter object associated with this console.

@texadactyl
Copy link
Collaborator Author

With this PR and the updated jacotest, W-L = 52-60.

@platypusguy platypusguy merged commit dd2f321 into platypusguy:main Feb 28, 2024
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.

2 participants
0