Bless EXT:GET-PID as the offical way to get procees id

Regenerate TeX artifacts.  My they were a bit dusty…

N.b. under pure Threaded OS platforms such as Microsoft Windows, there
is no valid process id.
parent c6bb8aff
......@@ -319,7 +319,24 @@ not-documented
--- Macro: \textbf{collect} [\textbf{extensions}] \textit{}
\begin{adjustwidth}{5em}{5em}
not-documented
Collect ({(Name [Initial-Value] [Function])}*) {Form}*
Collect some values somehow. Each of the collections specifies a bunch of
things which collected during the evaluation of the body of the form. The
name of the collection is used to define a local macro, a la MACROLET.
Within the body, this macro will evaluate each of its arguments and collect
the result, returning the current value after the collection is done. The
body is evaluated as a PROGN; to get the final values when you are done, just
call the collection macro with no arguments.
Initial-Value is the value that the collection starts out with, which
defaults to NIL. Function is the function which does the collection. It is
a function which will accept two arguments: the value to be collected and the
current collection. The result of the function is made the new value for the
collection. As a totally magical special-case, the Function may be Collect,
which tells us to build a list in forward order; this is the default. If an
Initial-Value is supplied for Collect, the stuff will be rplacd'd onto the
end. Note that Function may be anything that can appear in the functional
position, including macros and lambdas.
\end{adjustwidth}
\paragraph{}
......@@ -379,7 +396,7 @@ not-documented
\paragraph{}
\label{EXTENSIONS:FILE-DIRECTORY-P}
\index{FILE-DIRECTORY-P}
--- Function: \textbf{file-directory-p} [\textbf{extensions}] \textit{pathspec}
--- Function: \textbf{file-directory-p} [\textbf{extensions}] \textit{pathspec \&key (wild-error-p t)}
\begin{adjustwidth}{5em}{5em}
not-documented
......@@ -421,6 +438,17 @@ not-documented
not-documented
\end{adjustwidth}
\paragraph{}
\label{EXTENSIONS:GET-PID}
\index{GET-PID}
--- Function: \textbf{get-pid} [\textbf{extensions}] \textit{}
\begin{adjustwidth}{5em}{5em}
Get the process identifier of this lisp process.
Used to be in SLIME but generally useful, so now back in ABCL proper.
\end{adjustwidth}
\paragraph{}
\label{EXTENSIONS:GET-SOCKET-STREAM}
\index{GET-SOCKET-STREAM}
......
......@@ -52,7 +52,23 @@ directory to search for classes or a list of such values.
--- Macro: \textbf{chain} [\textbf{java}] \textit{}
\begin{adjustwidth}{5em}{5em}
not-documented
Performs chained method invocations. `target' is the receiver
object (when the first call is a virtual method call) or a list in the
form (:static <jclass>) when the first method call is a static method
call. `op' and each of the `ops' are either method designators or lists
in the form (<method designator> \&rest args), where a method designator
is either a string naming a method, or a jmethod object. `chain' will
perform the method call specified by `op' on `target'; then, for each
of the `ops', `chain' will perform the specified method call using the
object returned by the previous method call as the receiver, and will
ultimately return the result of the last method call.
For example, the form:
(chain (:static "java.lang.Runtime") "getRuntime" ("exec" "ls"))
is equivalent to the following Java code:
java.lang.Runtime.getRuntime().exec("ls");
\end{adjustwidth}
\paragraph{}
......@@ -198,7 +214,8 @@ not-documented
--- Function: \textbf{java-exception-cause} [\textbf{java}] \textit{java-exception}
\begin{adjustwidth}{5em}{5em}
not-documented
Returns the cause of JAVA-EXCEPTION. (The cause is the Java Throwable
object that caused JAVA-EXCEPTION to be signalled.)
\end{adjustwidth}
\paragraph{}
......@@ -326,9 +343,7 @@ When called with one argument, returns the name of the Java class
--- Function: \textbf{jclass-of} [\textbf{java}] \textit{object \&optional name}
\begin{adjustwidth}{5em}{5em}
Returns the name of the Java class of OBJECT. If the NAME argument is
supplied, verifies that OBJECT is an instance of the named class. The name
of the class or nil is always returned as a second value.
not-documented
\end{adjustwidth}
\paragraph{}
......@@ -647,7 +662,7 @@ Returns a new Java array with base type ELEMENT-TYPE (a string or a class-ref)
\paragraph{}
\label{JAVA:JNEW-RUNTIME-CLASS}
\index{JNEW-RUNTIME-CLASS}
--- Function: \textbf{jnew-runtime-class} [\textbf{java}] \textit{class-name \&rest args \&key (superclass java.lang.Object) interfaces constructors methods fields (access-flags (quote (public))) annotations}
--- Function: \textbf{jnew-runtime-class} [\textbf{java}] \textit{class-name \&rest args \&key (superclass java.lang.Object) interfaces constructors methods fields (access-flags (quote (public))) annotations (class-loader (make-memory-class-loader))}
\begin{adjustwidth}{5em}{5em}
Creates and loads a Java class with methods calling Lisp closures
......@@ -671,12 +686,12 @@ Creates and loads a Java class with methods calling Lisp closures
(METHOD-NAME RETURN-TYPE ARGUMENT-TYPES FUNCTION \&key MODIFIERS ANNOTATIONS)
where
METHOD-NAME is a string
where
METHOD-NAME is a string
RETURN-TYPE denotes the type of the object returned by the method
ARGUMENT-TYPES is a list of parameters to the method
The types are either strings naming fully qualified java classes or Lisp keywords referring to
The types are either strings naming fully qualified java classes or Lisp keywords referring to
primitive types (:void, :int, etc.).
FUNCTION is a Lisp function of minimum arity (1+ (length
......
......@@ -16,6 +16,15 @@ Whether backwards compatibility with JSS's use of CL-USER has been enabled.
Whether to automatically introspect all Java classes on the classpath when JSS is loaded.
\end{adjustwidth}
\paragraph{}
\label{JSS:*MUFFLE-WARNINGS*}
\index{*MUFFLE-WARNINGS*}
--- Variable: \textbf{*muffle-warnings*} [\textbf{jss}] \textit{}
\begin{adjustwidth}{5em}{5em}
not-documented
\end{adjustwidth}
\paragraph{}
\label{JSS:CLASSFILES-IMPORT}
\index{CLASSFILES-IMPORT}
......
......@@ -373,6 +373,7 @@
"fdefinition.lisp"
"fill.lisp"
"find-all-symbols.lisp"
"get-pid.lisp"
"gentemp.lisp"
"gray-streams.lisp"
"gui.lisp"
......
(in-package :extensions)
(export '(get-pid)
:extensions)
(defun get-pid ()
"Get the process identifier of this lisp process.
Used to be in SLIME but generally useful, so now back in ABCL proper."
(handler-case
(let* ((runtime
(java::jstatic "getRuntime" "java.lang.Runtime"))
(command
(java::jnew-array-from-array
"java.lang.String" #("sh" "-c" "echo $PPID")))
(runtime-exec-jmethod
;; Complicated because java.lang.Runtime.exec() is
;; overloaded on a non-primitive type (array of
;; java.lang.String), so we have to use the actual
;; parameter instance to get java.lang.Class
(java::jmethod "java.lang.Runtime" "exec"
(java::jcall
(java::jmethod "java.lang.Object" "getClass")
command)))
(process
(java::jcall runtime-exec-jmethod runtime command))
(output
(java::jcall (java::jmethod "java.lang.Process" "getInputStream")
process)))
(java::jcall (java::jmethod "java.lang.Process" "waitFor")
process)
(loop :with b :do
(setq b
(java::jcall (java::jmethod "java.io.InputStream" "read")
output))
:until (member b '(-1 #x0a)) ; Either EOF or LF
:collecting (code-char b) :into result
:finally (return
(parse-integer (coerce result 'string)))))
(t () 0)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment