TerminalEmulatorDemoModuleOrg

Contents


Organization of Terminal Application Modules (back to TerminalEmulator)

These modules and packages are available under lib.terminalemulator/demosrc:

Module name Module display name Pkgs Salient classes Comments
lib.richexecution RichExecution o.n.lib.richexecution Program Command Shell Things to run
" " " Pty JNAPty The pty and it's implementation
" " " PtyExecutor Runs a Program to create a ...
" " " PtyProcess A process running with it's i/o connected to a Pty.
" " process_start.sh process_start-<platform> Helper script and binaries
lib.termsupport TermSupport o.n.lib.termsupport FindBar FindState LineFilter TermExecutor Utilities
lib.termsupport/nbterm TermApp nbterm Standalone application
" " release/nbterm A driver shellscript
terminal Terminal o.n.modules.terminal Implementation
" " o.n.modules.terminal.api Terminal TerminalProvider Main API for getting at terminals
" " o.n.modules.terminal.ioprovider TerminalIOPRovider TerminalInputOutput See TerminalEmulatorAndOutput
terminal/examples TerminalExamples o.n.terminal.examples See TerminalEmulatorAndOutput
Suite Suite Suite to manage the above while under /demosrc


libraries vs Libraries

The modules o.n.lib.terminalemulator, richexecution and termsupport are standalone libraries. Initially they were managed as Java projects with o.n.lib.richexecution and o.n.lib.termsupport getting corresponding wrapper modules.

However, enhancing and by-hand maintaining the wrappers per DevFaqWrapperModules and the additional burden of correctly managing the helper binaries and scripts made this too hard to maintain.

Therefore, these modules are regular NB modules. Their presence in the o.n.lib package signifies that they should remain pure and not depend on other NB modules.

process_start and native code in NB

In order to correctly bind a pty to a processes i/o one needs to execute the program in a special way. Stock java execution (ProcessFactory) just doesn't have these facilities.
We work around this by using a trampoline helper executable. I initially hoped that the this work could be adequately accomplished by a shell script, process_start.sh, but due to NetbeansStartupAndCtlC (and possibly TerminalEmulatorOnMac) had to resort to native executables.


__Native executables in NetBeans?
Don't Panic!__

The program in question is written in C. It is a short program which fits in one file, lib.richexecution/procss_start.c, and can be compiled from within ant with a minimum of fuss:

        <exec executable="cc"
              resultproperty="exitcode"
              failifexecutionfails="false">
            <arg value="process_start.c"/>
            <arg value="-m32"/>
            <arg value="-o"/>
            <arg value="${build.lib}/process_start-${platform}"/>
        </exec>

Note the failifexecutionfails="false". A failed compilation is OK. If things don't work out, ultimately, the richexecution runtime will fall back on process_start.sh with the attendant reduced functionlity.

But do I have to build on all platforms?

No.

In general, pre-built, per-platform, stipped and zipped versions of process_start will be available under source code control. A standard build will just extract the binary, if it exists, and manage it as described further below. But if you're a maintainer things will work differently.

You're a maintainer if your login name appears in lib.richexecution/maintainers.properties. If this is the case a standard build will attempt to compile process_start.c as described above.

Maintainers have an additional responsibility ... to run the update_zip target if they make any changes to process_start.c

Managing process_start (nee pty_bind) and nbterm

  • process_start-<platform> are helper executables which help start processes connected to ptys
  and return their PIDs.
  • process_start.sh is a helper shellscript used as a fallkback on platforms where the binary
 version is not available.
  • nbterm is a startup shellscript for the standalone application.

Build scripts had to be enhanced by hand to move them where needed:

  • process_start (all variations) is installed under dist/lib/ in the standalone application
 and under Suite/build/cluster/modules/ext/lib/ in the module version.
 
See comment at beginning of lib.richexecution/build.xml for more detail.
  • nbterm is installed under dist/ in the standalone application.
 
See comment at beginning of lib.termsupport/nbterm/build.xml for more detail.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo