### APIDOC: MyApplication Class for LispWorks Initialization Example Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 The `MyApplication` class serves as a demonstration of how to initialize the LispWorks runtime when an Android application starts. It illustrates the use of `com.lispworks.Manager.init` within the `onCreate` method of the application class, although the provided demo itself uses alternative initialization mechanisms. ```APIDOC Class: MyApplication Purpose: - Demonstrates LispWorks initialization at application startup. - Calls `com.lispworks.Manager.init` in the `onCreate` method. - Not directly used in the demo; `SplashScreen` and `Othello` activities handle initialization independently. ``` -------------------------------- ### Reference External SSL Server Example Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-comm-130 Provides a pointer to an external file containing an example of how to set up a server that uses SSL connections, guiding users to more advanced security-focused implementations. ```Common Lisp (example-edit-file "ssl/ssl-server") ``` -------------------------------- ### LispWorks COMM Asynchronous I/O Example Files Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-examples-ug-1 These Lisp code snippets illustrate how to access and edit example files demonstrating the Asynchronous I/O API in LispWorks. These examples provide practical demonstrations of non-blocking input/output operations and are detailed in the 'Asynchronous I/O' section of the LispWorks User Guide, showcasing efficient data handling. ```Lisp (example-edit-file "async-io/driver") ``` ```Lisp (example-edit-file "async-io/multiplication-table") ``` ```Lisp (example-edit-file "async-io/print-connection-delay") ``` ```Lisp (example-edit-file "ssl/async-io-client") ``` ```Lisp (example-edit-file "async-io/udp") ``` -------------------------------- ### Open Othello Demo README File in LispWorks Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 This Lisp expression is used within the LispWorks environment to open the `README.txt` file associated with the Android Othello demo. This file typically contains essential information and instructions for the example application. ```Lisp (example-edit-file "android/README.txt") ``` -------------------------------- ### Open macOS Application Bundle Configuration Example File (Lisp) Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-examples-ug-5 This Lisp code snippet uses the `example-edit-file` function to open or edit the example file located at "configuration/macos-application-bundle". This file illustrates how to create an application bundle when saving a LispWorks image on macOS. It serves as a starting point for customizing bundle creation, though standard functions like `create-macos-application-bundle` are generally recommended. ```Lisp (example-edit-file "configuration/macos-application-bundle") ``` -------------------------------- ### Start Server with Dynamic Port Assignment and Query Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-comm-130 This example shows how to start a server without specifying a fixed port, allowing the system to pick a free one. It includes a custom announce function to capture the assigned socket and demonstrates how to query that socket to discover the dynamically assigned port. ```Common Lisp (defvar *my-socket* nil) ``` ```Common Lisp (defun my-announce-function (socket condition) (if socket (setf *my-socket* socket) (my-log-error condition))) ``` ```Common Lisp (comm:start-up-server :service nil :error nil :announce 'my-announce-function) ``` ```Common Lisp (multiple-value-bind (address port) (comm:get-socket-address *my-socket*) port) ``` -------------------------------- ### Lisp example-file Function Usage Example Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-45 An example demonstrating how to use the `example-file` function in Lisp to get the path to a specific file within the LispWorks examples directory, showing both the function call and its expected output. ```Lisp (example-file "capi/applications/othello.lisp") => #P"C:/Program Files/LispWorks/lib/8-1-0-0/examples/capi/applications/othello.lisp" ``` -------------------------------- ### Start Profiling Current Process Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-hcl-161 An example demonstrating how to initiate profiling specifically for the current Lisp process, followed by a placeholder for the work to be profiled. ```Lisp (start-profiling :processes :current) (do-interesting-work) ``` -------------------------------- ### APIDOC: LispWorksRuntimeDemo Class for Splash Screen and Lisp Initialization Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 The `LispWorksRuntimeDemo` class provides an example of displaying a splash screen while simultaneously initializing the LispWorks runtime. It checks the LispWorks status using `com.lispworks.Manager.status` and performs initialization with `com.lispworks.Manager.init` if necessary. This class is primarily for demonstration purposes, as other parts of the application might also handle initialization. ```APIDOC Class: LispWorksRuntimeDemo Purpose: - Displays a splash screen during LispWorks initialization. - Checks LispWorks status using `com.lispworks.Manager.status`. - Initializes LispWorks using `com.lispworks.Manager.init` if initialization is required. - Serves as an example for integrating splash screens with Lisp runtime setup. ``` -------------------------------- ### Example Initial Values for *lispworks-directory* Variable Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-70 These examples illustrate typical initial values for the `*lispworks-directory*` variable across different operating systems and installation types. The values are Lisp pathname objects, demonstrating how the variable might be set on Linux, Solaris, FreeBSD, Microsoft Windows, and macOS. ```Lisp #P"/usr/local/lib/LispWorks/" ``` ```Lisp #P"/usr/lib64/LispWorks/" ``` ```Lisp #P"C:\Program Files\LispWorks\" ``` ```Lisp #P"C:\Program Files (x86)\LispWorks\" ``` ```Lisp #P"/Applications/LispWorks 8.1 (64-bit)/Library/" ``` -------------------------------- ### Open LispWorks Example Source File Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-preface This LispWorks form allows users to open and view example source files provided with the LispWorks installation. These files are typically found under the `lib/8-1-0-0/examples/` directory. ```Lisp (example-edit-file "ssl/ssl-client") ``` -------------------------------- ### Configure LispWorks Project Path for Android Delivery Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 This Lisp code snippet defines the `*project-path*` variable, which specifies the root directory of the Android project where LispWorks will deliver its runtime components. Users must update this path in their copied build script to match their local project setup. ```Lisp (defvar *project-path* "~/my-workspace/LispWorksRuntimeDemo/") ``` -------------------------------- ### Locate Android UI Demonstration Files Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 These Lisp expressions point to files that define functions (`raise-alert-dialog` and `raise-a-toast`) demonstrating how to directly interact with native Android UI components like dialogs and toasts from Lisp code. ```Lisp (example-edit-file "android/dialog") ``` ```Lisp (example-edit-file "android/toast") ``` -------------------------------- ### LispWorks Listener Command Examples Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-listener-ug-2 Demonstrates the usage of various LispWorks Listener commands including :redo, :his, :get, :use, and :bug-form with sample outputs and inputs. ```Lisp CL-USER 4 > :redo (MAKE-ANIMAL :SPECIES "Hippopotamus" :NAME ...) #S(ANIMAL :SPECIES "Hippopotamus" :NAME "Hilda" :WEIGHT 42) CL-USER 5 > :his 1: (PRINT 42) 2: (DEFSTRUCT ANIMAL SPECIES NAME ...) 3: (MAKE-ANIMAL :SPECIES "Hippopotamus" :NAME ...) 4: (MAKE-ANIMAL :SPECIES "Hippopotamus" :NAME ...) CL-USER 5 > :get make-hilda 3 CL-USER 5 > make-hilda (MAKE-ANIMAL :SPECIES "Hippopotamus" :NAME "Hilda" :WEIGHT 42) CL-USER 6 > :use "Henry" "Hilda" (MAKE-ANIMAL :SPECIES "Hippopotamus" :NAME ...) #S(ANIMAL :SPECIES "Hippopotamus" :NAME "Henry" :WEIGHT 42) CL-USER 7 > :bug-form "Too many hippos..." :filename "bug-report.txt" ``` -------------------------------- ### LispWorks Java API for Manager and Initialization Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 This snippet documents LispWorks Java API methods from the `com.lispworks.Manager` class, used by the `Othello` application to manage LispWorks runtime status, initialization, and retrieve error details. ```APIDOC com.lispworks.Manager.status(): int Description: Checks the current status of the LispWorks runtime. Returns: An integer representing the LispWorks status (e.g., ready, not ready, error). com.lispworks.Manager.init(runnable: Runnable): void Description: Initializes the LispWorks runtime. If Lisp is not ready, it calls this method, passing a Runnable to be executed once initialization is complete. Parameters: runnable: A Runnable object to be executed after LispWorks initialization. com.lispworks.Manager.mInitErrorString: String Description: A field containing the error message string if LispWorks initialization failed. com.lispworks.Manager.init_result_code: int Description: A field containing the result code of the LispWorks initialization, indicating success or specific error types. ``` -------------------------------- ### LispWorks set-up-profiler Function API Reference Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-hcl-158 Detailed API documentation for the `set-up-profiler` function, outlining its purpose, parameters, their accepted values, default behaviors, and any specific notes or limitations. ```APIDOC Function: set-up-profiler Description: Used to declare the values of the parameters of the profiling function. Parameters: packages: Description: Specifies that the symbols in these packages should be monitored. Type: Keyword | List of package specifiers Values: :all: Symbols in all packages are monitored. :none: No package is used to find symbols to monitor. List of package specifiers: Symbols in these specific packages are monitored. Default Behavior: If nil (and symbols is nil), behaves as :all. Note: To monitor no symbols, pass :packages :none. symbols: Description: A list of function-dspecs to monitor in addition to symbols specified by 'packages'. Type: List of function-dspecs (typically symbols) Note: When a symbol naming a generic function is monitored, LispWorks adds all its methods to the profile list. kind: Description: Specifies the way time between samples is measured on Unix-like platforms. Type: Keyword Values: :profile: Process time only. :virtual: Process time and system time for the process. :real: Real time. Default: :profile Note: Ignored on Microsoft Windows platforms. interval: Description: Interval in microseconds between profile samples. Type: Integer Minimum: 10000 (10 ms) Default: 10000 limit: Description: When non-nil, sets *default-profiler-limit*. Limits the maximum number of lines printed in the profile output (not including the tree). Type: Integer (non-nil) Default: 100 cutoff: Description: When non-nil, sets *default-profiler-cutoff*. Default minimum percentage that the profiler will display in the output tree. Functions below this percentage will not be displayed. Type: Number (non-nil) Default: nil (no cutoff) collapse: Description: Specifies whether functions with only one callee in the profile tree should be collapsed (only the child is printed). When passed, sets *default-profiler-collapse*. Type: Boolean (non-nil) Default: nil style: Description: Controls the format of output. Type: Keyword Values: :list: The profiler will show the functions seen on the stack. :tree: The profiler will generate a tree of calls seen in the profiler, as well as the output shown by :list. Default: :tree (if not passed or nil, format does not change) gc: Description: Specifies profiling of functions in the memory management code that perform garbage collection (GC). Type: Boolean | Keyword Values: nil: GC functions are not profiled. t: GC functions are profiled. :exclude: If a GC operation is in progress when sampling, the sample is skipped. Default: nil call-counter: Description: Specifies whether to add extra code to count calls dynamically. Type: Boolean Values: nil: Call counters are not added (displayed as 0). t: Call counters are added. Default: nil in SMP LispWorks, t in non-SMP LispWorks (due to performance impact on SMP). show-unknown-frames: Description: Controls whether the profile tree shows nodes where the name of the function is unknown. Type: Boolean Default: nil kw-contexts: Description: Allows profiling forward chaining rules in KnowledgeWorks. Type: Boolean | List of context names Values: t: All contexts are profiled. List of context names: Profiles all forward rules in each specified context. Default: t subfunctions: Description: Controls whether to profile subfunctions of the functions that are profiled. Type: Boolean (non-nil) Default: nil Note: If non-nil, initializing the profiler is slower and output is messier, but can be useful. ``` -------------------------------- ### Save LispWorks Image with Multiprocessing Enabled Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-multiprocessing-ug-2 Example code demonstrating how to save a LispWorks image that automatically starts multiprocessing upon execution. This is an alternative to starting multiprocessing interactively or via command-line arguments. ```Lisp (save-image "mp-lispworks" :multiprocessing t) ``` -------------------------------- ### API Documentation for setup-lisp-proxy Function Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lw-ji-92 Detailed API reference for the `setup-lisp-proxy` function, including its signature, parameters, return values, and a description of its functionality and differences from `define-lisp-proxy`. ```APIDOC Function Name: setup-lisp-proxy Package: lw-ji Signature: setup-lisp-proxy name interface-and-method-descs => lisp-proxy-name Arguments: name: A symbol. Can be nil, in which case a symbol is generated and returned. interface-and-method-descs: A list describing Java interfaces to implement and Lisp functions to call. Parsed similarly to define-lisp-proxy. Values: lisp-proxy-name: A symbol, which is the name of the defined Lisp proxy. Description: The function `setup-lisp-proxy` defines a Lisp proxy. Unlike `define-lisp-proxy`, the `name` argument can be `nil`, causing `setup-lisp-proxy` to generate a symbol using `cl:gensym` and return it as the proxy name. The `interface-and-method-descs` argument is a list that specifies the Java interfaces to implement and the Lisp functions to be called, parsed in the same manner as for `define-lisp-proxy`. ``` -------------------------------- ### Start Multiplier Process with Sleep Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 Starts a background process named 'multiplier' that simulates a lengthy computation. It performs iterations, sleeps for a second in each, and prints the square of the iteration number. The process can be stopped by setting `*finish-multiply*`. ```Lisp (mp:process-run-function "multiplier" () #'(lambda() (setq *finish-multiply* nil) (dotimes (x 100) (sleep 1) (when *finish-multiply* (return)) (lw-ji:format-to-java-host "~%~d * ~d = ~d" x x (* x x))))) ``` -------------------------------- ### Stop Multiplier Process Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 Sets the `*finish-multiply*` variable to `t` (true), signaling the 'multiplier' process (started in the previous step) to terminate its ongoing computation. ```Lisp (setq *finish-multiply* t) ``` -------------------------------- ### Get LispWorks Image Path on Linux Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-69 Illustrates the usage of the `lisp-image-name` function to obtain the full path of the running LispWorks executable on a Linux system. This example provides the typical output for a standard LispWorks installation on Linux. ```Lisp CL-USER 1 > (lisp-image-name) "/usr/bin/lispworks-8-1-0-x86-linux" ``` -------------------------------- ### LispWorks SQL: Basic Database Connection Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-sql-ug-2 Demonstrates a simple connection to a SQL database using `sql:connect` with a username and password. This is a basic, direct connection example. ```Lisp (sql:connect "scott/tiger") ``` -------------------------------- ### Get LispWorks Image Path on Windows Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-69 Demonstrates how to use the `lisp-image-name` function to retrieve the full path of the running LispWorks executable on a Windows system. The example shows the typical output for a standard LispWorks installation on Windows. ```Lisp CL-USER 1 > (lisp-image-name) "C:\\Program Files\\LispWorks\\lispworks-8-1-0-x86-win32.exe" ``` -------------------------------- ### LispWorks SYSTEM: setup-atomic-funcall Function API Reference Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-sys-137 Detailed API documentation for the `setup-atomic-funcall` function, including its summary, package, signature, arguments, and a comprehensive description of its atomic execution behavior and use cases in Symmetric Multi-Processing (SMP) LispWorks. It also lists related functions. ```APIDOC Function: setup-atomic-funcall Summary: Sets up mutually atomic funcalls in SMP LispWorks. Package: system Signature: setup-atomic-funcall &rest function-and-arguments Arguments: function-and-arguments: A list. Description: The function `setup-atomic-funcall` sets up a funcall using function-and-arguments, which will be executed atomically with respect to any other calls which were also set up by `setup-atomic-funcall`. Calling `setup-atomic-funcall` causes the execution of the form: (apply (car function-and-arguments) (cdr function-and-arguments)) some time after the entry to `setup-atomic-funcall`. The call may happen before `setup-atomic-funcall` returns, and it is expected that normally this is what will happen. However, it may be delayed for an indefinite period, but normally this period is short (milliseconds). The execution occurs atomically with respect to other calls that were set up by `setup-atomic-funcall`. The call should be short, because otherwise it will delay all the other calls. If an error occurs during the call, the atomicity is no longer guaranteed. `setup-atomic-funcall` is useful when a process needs to atomically tell another process to do something, but does not need to wait for it to finish. `setup-atomic-funcall` causes less congestion than using a lock, and so is more efficient for locks that may cause congestion. compare-and-swap and atomic-exchange operations will be faster. See also: atomic-exchange compare-and-swap ``` -------------------------------- ### LispWorks COMM SSL Example Files Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-examples-ug-1 These Lisp code snippets illustrate how to access and edit example files demonstrating the use of SSL (Secure Sockets Layer) in LispWorks socket streams. These examples are described in detail in the 'Using SSL' section of the LispWorks User Guide, providing practical insights into secure communication. ```Lisp (example-edit-file "ssl/ssl-server") ``` ```Lisp (example-edit-file "ssl/ssl-client") ``` ```Lisp (example-edit-file "ssl/ssl-certificates") ``` -------------------------------- ### Reference LispWorks SSL Example Files Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-comm-49 These Lisp code snippets show how to load example files related to SSL certificates and SSL server implementations within the LispWorks environment. They demonstrate the use of the `example-file` function to access pre-defined examples. ```Lisp (example-file "ssl/ssl-certificates") (example-file "ssl/ssl-server") ``` -------------------------------- ### LispWorks COMM Package: start-up-server-and-mp Function API Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-comm-131 Comprehensive API documentation for the `start-up-server-and-mp` function in the LispWorks COMM package. This includes its full signature, a detailed breakdown of all supported keyword arguments with their types and descriptions, and important notes about its implementation, such as its unavailability on Microsoft Windows. ```APIDOC Function: start-up-server-and-mp Package: comm Signature: start-up-server-and-mp &key function announce service backlog address local-address local-port nodelay keepalive process-name wait create-stream ipv6 error Arguments: function (function name): A function name. announce (output stream | t | nil | function): An output stream, t, nil or a function. service (integer | string | nil): An integer, a string or nil. backlog (nil | positive integer): nil or a positive integer. address (synonym for local-address): A synonym for local-address. local-address (integer | ipv6-address object | string | nil): An integer, an ipv6-address object, a string or nil. local-port (synonym for service): A synonym for service. nodelay (generalized boolean): A generalized boolean. keepalive (generalized boolean): A generalized boolean. process-name (symbol | string): A symbol or string. wait (boolean): A boolean. create-stream (boolean, default nil): A boolean, default nil. ipv6 (keyword :any | keyword :both | nil | t): The keyword :any, the keyword :both, nil or t. error (boolean): A boolean. Description: The function `start-up-server-and-mp` starts multiprocessing if it has not already been started and then calls `start-up-server` with the supplied function, announce, service, backlog, address, local-address, local-port, nodelay, keepalive, process-name, wait, create-stream, ipv6 and error arguments. Notes: `start-up-server-and-mp` is not implemented on Microsoft Windows. ``` -------------------------------- ### Start Error-Generating Process Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-android-ug-4 Launches a new process named 'Error' that intentionally attempts to open an invalid file path, causing an error. This demonstrates how to trigger and observe errors in a separate process, with details available in the Bug form logs. ```Lisp (mp:process-run-function "Error" () #'(lambda () (open "junk;;file::name"))) ``` -------------------------------- ### API Reference: setup-deliver-dynamic-library-for-java Function Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lw-ji-89 Comprehensive API documentation for the `setup-deliver-dynamic-library-for-java` function, detailing its purpose, package, signature, arguments, return values, and behavior when preparing LispWorks for Java integration. ```APIDOC Function: setup-deliver-dynamic-library-for-java Package: lw-ji Signature: setup-deliver-dynamic-library-for-java &key init-java function asynchronous => result Arguments: init-java: Boolean, default t. Controls automatic Java interface initialization. function: A function designator for a function of no arguments. Called after Java interface initialization. asynchronous: Boolean, default nil. Controls whether initialization is asynchronous from Java's perspective. Values: result: Always t. Description: Prepares the LispWorks internal state for delivering a dynamic library that can be loaded from Java and use the Java interface. Should be called just before calling deliver. It causes deliver to produce a dynamic library. When the delivered image is loaded into Java, the host Java virtual machine is remembered and can be retrieved by get-host-java-virtual-machine. If init-java is non-nil, the Java interface is automatically initialized by init-java-interface. If function is non-nil, it is then called with no arguments. Initialization occurs after the deliver startup function returns. When asynchronous is false (default), the Java method that loads Lisp waits until Lisp has finished initialization. When asynchronous is true, the loading method returns immediately and LispWorks initializes asynchronously. In asynchronous case, calls from Java to Lisp (com.lispworks.LispCalls) may block until Lisp is ready (up to 50 seconds). Readiness can be checked using com.lispworks.LispCalls.waitForInitialization. ``` -------------------------------- ### LispWorks DDE Client: dde-advise-start* Function API Reference Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-win32-dde-client-2 Detailed API documentation for the `dde-advise-start*` function, including its signature, parameters, return values, and behavior for establishing and managing DDE advise loops in LispWorks. ```APIDOC Function: dde-advise-start* Package: win32 Signature: dde-advise-start* service topic item &key key function format datap type errorp connect-error-p new-conversation-p => result Arguments: service: A string or symbol. topic: A string or symbol. item: A string or symbol. key: An object. function: A function name. format: A clipboard format specifier. datap: A boolean. type: A keyword. errorp: A boolean. connect-error-p: A boolean. new-conversation-p: A boolean. Values: result: A boolean. Description: The function dde-advise-start* is similar to dde-advise-start, and sets up an advise loop for the data item specified by item on a conversation with the server specified by service on a topic given by topic. If connect-error-p is t (the default value) and a conversation cannot be established, then LispWorks signals an error. If connect-error-p is nil, dde-advise-start* returns nil if a conversation cannot be established. If new-conversation-p is t then a new conversation is always established for the advise loop. key is used to identify this link. If specified as nil (the default value), it defaults to the conversation. Multiple links are permitted on a conversation with the same item and format values, as long as their key values differ. If the link is established, the return value result is t. If the link could not be established, the behavior depends on the value of errorp. If errorp is t (the default value), LispWorks signals an error. If it is nil, the function returns nil to indicate failure. If the link is established, the function 'function' will be called whenever the data changes. If 'function' is nil (the default value), the generic function dde-client-advise-data will be called. ``` -------------------------------- ### Load LispWorks Buffered Stream Example File Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-examples-ug-2 This Lisp code snippet utilizes the `example-edit-file` function to load and open the source code for the 'buffered-stream' example. This function is typically used within the LispWorks IDE to bring up an example file for inspection or modification, facilitating hands-on learning with the provided examples. ```Lisp (example-edit-file "streams/buffered-stream") ``` -------------------------------- ### Start Basic Lisp Listener Server Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-comm-130 Demonstrates how to start a simple Lisp listener server using `comm:start-up-server` on a specified TCP port (10243). This server accepts client connections, reads Common Lisp expressions, and executes them in a new lightweight process. ```Common Lisp (comm:start-up-server :service 10243) ``` -------------------------------- ### Minimal XML Parsing Example in LispWorks Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-examples-ug-6 This snippet shows how to access a minimal example file for parsing XML within the LispWorks environment. It's designed to illustrate basic XML processing capabilities. ```Lisp (example-edit-file "misc/xml-parser") ``` -------------------------------- ### Locate LispWorks Java DLL Example File Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lw-ji-89 A Lisp code snippet demonstrating how to locate the example file for delivering LispWorks as a DLL for Java. ```Lisp (example-edit-file "java/lisp-as-dll/README.txt") ``` -------------------------------- ### Example: Get Ultimate Parent of a Subfunction Dspec Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-dspec-16 This example demonstrates how `dspec-progenitor` processes a nested `subfunction` dspec to return its top-level parent, which in this case is a `defun` dspec. ```Lisp (dspec-progenitor '(subfunction 1 (subfunction (flet a) (defun foo)))) => (defun foo) ``` -------------------------------- ### LispWorks SQL: Connecting to Database at Application Runtime Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-sql-ug-2 Shows how to establish a database connection using `sql:connect` at various points during the application's runtime. This connection happens after the delivered application has started. ```Lisp (sql:connect "scott/tiger") ``` -------------------------------- ### LispWorks load-system Basic Usage Example Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-72 Example demonstrating the basic usage of the `load-system` function to load a system named 'blackboard'. ```Lisp (load-system 'blackboard) ``` -------------------------------- ### Lisp Examples for count-regexp-occurrences Function Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-21 Illustrative Lisp code examples demonstrating the usage of `count-regexp-occurrences` with various patterns, strings, and keyword arguments like `:overlap` and `:start`. ```Lisp (count-regexp-occurrences "aaa" "aaaaa") => 1 (count-regexp-occurrences "aaa" "aaaaa" :overlap t) => 3 (count-regexp-occurrences "12" "81267124") => 2 (count-regexp-occurrences "12" "81267124" :start 4) => 1 (let* ((path (example-file "capi/elements/text-input-pane.lisp")) (file-string (file-string path))) (count-regexp-occurrences ":title" file-string)) => 20 ; in LispWorks 7.1 ``` -------------------------------- ### LispWorks SQL: Connecting to Multiple Databases and Listing Connections Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-sql-ug-2 Demonstrates how to set a default database type, connect to multiple distinct databases (e.g., 'scott' and 'personnel'), and then retrieve and print a list of all currently active database connection instances. ```Lisp (setf *default-database-type* :odbc) (connect "scott") (connect "personnel" :database-type :odbc) (print *connected-databases*) ``` -------------------------------- ### Lisp: Display CAPI Othello Example File Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-44 Demonstrates how to use the `example-edit-file` function to open the 'othello.lisp' example file located in the 'capi/applications' subdirectory of the LispWorks examples folder. ```Lisp (example-edit-file "capi/applications/othello") ``` -------------------------------- ### LispWorks dde-advise-start Function API Documentation Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-win32-dde-client-1 Comprehensive API documentation for the `dde-advise-start` function in LispWorks, detailing its purpose, package, signature, arguments, and return values for setting up DDE advise loops. It explains how to configure hot or warm links, specify data formats, and handle errors. ```APIDOC Function: dde-advise-start Package: win32 Summary: Sets up an advise loop on a specified data item for a conversation. Signature: dde-advise-start conversation item &key key function format datap type errorp => result Arguments: conversation: A conversation object. item: A string or symbol. key: An object. function: A function name. format: A clipboard format specifier. datap: A boolean. type: A keyword. errorp: A boolean. Values: result: A boolean. Description: The function `dde-advise-start` sets up an advise loop for the data item specified by item on the specified conversation. See 22.2.3 Advise loops for information about DDE advise loops. format should be one of the following: * A DDE format specifier, consisting of either a standard clipboard format or a registered clipboard format. * A string containing either the name of a standard clipboard format (without the `CF_` prefix), or the name of a registered clipboard format. * A symbol, in which case its print name is taken to specify the clipboard format. * The keyword `:text` – the default value of format. The keyword `:text` is treated specially. If supported by the server it uses the `CF_UNICODETEXT` clipboard format, otherwise it used the `CF_TEXT` format. type specifies how the response data should be converted to a Lisp object. For text formats, the default value indicates that a Lisp string should be created. The value `:string-list` may be specified to indicate that the return value should be taken as a tab-separated list of strings; in this case the Lisp return value is a list of strings. The default conversation class only supports text formats, unless type is specified as `:foreign`, which can be used with any clipboard format. It returns a `clipboard-item` structure, containing a foreign pointer to the data, the data length, and the format identifier. If datap is `t` (the default value), a hot link is established, where the new data is supplied whenever it changes. If datap is `nil`, a warm link is established, where the data is not passed, and must be explicitly requested using dde-request. key is used to identify this link. If specified as `nil` (the default value), it defaults to the conversation. Multiple links are permitted on a conversation with the same item and format values, as long as their key values differ. If the link is established, the return value result is `t`. If the link could not be established, the behavior depends on the value of errorp. If errorp is `t` (the default value), LispWorks signals an error. If it is `nil`, the function returns `nil` to indicate failure. If the link is established, the function function is called whenever the data changes. If function is `nil` (the default value), then the generic function dde-client-advise-data will be called. See also: dde-advise-start* dde-advise-stop dde-client-advise-data ``` -------------------------------- ### Example: Get Current Process Backtrace in Lisp Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-mp-74 Demonstrates how to use `mp:map-process-backtrace` to print the backtrace of the current Lisp process to the console. This example calls the `print` function for each line of the backtrace. ```Lisp CL-USER 1 > (mp:map-process-backtrace mp:*current-process* 'print) DBG::GET-CALL-FRAME MP:MAP-PROCESS-BACKTRACE SYSTEM::%INVOKE SYSTEM::%EVAL EVAL SYSTEM::DO-EVALUATION SYSTEM::%TOP-LEVEL-INTERNAL SYSTEM::%TOP-LEVEL SYSTEM::LISTENER-TOP-LEVEL CAPI::CAPI-TOP-LEVEL-FUNCTION CAPI::INTERACTIVE-PANE-TOP-LOOP (SUBFUNCTION MP::PROCESS-SG-FUNCTION MP::INITIALIZE-PROCESS-STACK) SYSTEM::%%FIRST-CALL-TO-STACK NIL ``` -------------------------------- ### LispWorks set-blocking-gen-num Initial Setup Example Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-sys-119 An example demonstrating the initial default call to `sys:set-blocking-gen-num` in LispWorks, setting the blocking generation to 3 for automatic garbage collection using Copying GC. ```Lisp (sys:set-blocking-gen-num 3) ``` -------------------------------- ### API Documentation for example-load-binary-file Function Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-lispworks-46 Details the signature, arguments, values, and behavior of the `example-load-binary-file` function in LispWorks, which loads a compiled Lisp file from a temporary path. ```APIDOC Function: example-load-binary-file Package: lispworks Signature: example-load-binary-file file => result Arguments: file: A pathname designator. Values: result: A generalized boolean. Description: The function `example-load-binary-file` constructs the path to an output file associated with 'file', but in the temporary location that would be used as the output-file by `example-compile-file`. It then calls `load` on that path, and returns the value 'result' returned by `load`. See also: example-compile-file ``` -------------------------------- ### API Reference for InitLispWorks C Function Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-c-functions-1 Detailed API documentation for the `InitLispWorks` C function, including its assumed signature, a description of its parameters, and a comprehensive breakdown of its possible return values, covering successful initialization, various timeout conditions, and specific failure codes. ```APIDOC Function: int InitLispWorks(int MilliTimeOut, int BaseAddress, int ReserveSize) Description: Allows you to relocate a LispWorks dynamic library if necessary, and offers control of the initialization process. While a LispWorks dynamic library is automatically initialized by any call to its exported symbols, `InitLispWorks` is necessary when you need to relocate LispWorks or need finer control over the initialization process. Parameters: MilliTimeOut: int The time in milliseconds to wait for LispWorks to finish initializing before returning. `InitLispWorks` checks whether the library was initialized and if not initiates initialization. It then waits at most `MilliTimeOut` milliseconds before returning. BaseAddress: int The base address for relocation. Can be 0. Interpreted as described in "27.6 Startup relocation". ReserveSize: int The reserve size for relocation. Can be 0. Interpreted as described in "27.6 Startup relocation". Return Values: Non-negative values (Success): 1: LispWorks was already initialized or in the process of initializing, and finished initializing by the time `InitLispWorks` returned. 0: `InitLispWorks` initialized LispWorks and the initialization finished successfully. Inclusive range [-1, -99] (Timeout): -1: `InitLispWorks` started initialization and timed out before LispWorks finished mapping itself from the file. -2: LispWorks already started initialization, and `InitLispWorks` timed out before LispWorks finished mapping itself from the file. -3: `InitLispWorks` started initialization and timed out after LispWorks mapped itself from the file, but before the initialization was complete. -4: LispWorks already started initialization, and `InitLispWorks` timed out before after LispWorks mapped itself from the file, but before the initialization was complete. Lower values (Failure): -1000: Failure to start a thread to do the initialization. -1401: The file seems to be corrupted. -1402: Failure to map into memory. -1403: Failure to read the LispWorks header from the file. -1406: Bad base address. -1408: Some failure in Lisp code during initialization. (In LispWorks 8.0, this can be reported only on Android). -1409: LispWorks failed to open its own executable/dynamic library. (In LispWorks 8.0, this can be reported only on Android). Inclusive range [-1400, -1001] on Linux, Macintosh, FreeBSD and x86/x64 Solaris: Indicates an error in a system call. Calculate the errno number by -1001 - value. Notes: - If LispWorks is already initialized or in the process of being initialized, `InitLispWorks` does not initiate the process of initialization. Therefore, arguments have no effect if LispWorks was already initialized. - On Microsoft Windows, the default behavior is to initialize a LispWorks dynamic library automatically during loading; this needs to be disabled to use `InitLispWorks` effectively. - Once `QuitLispWorks` has returned 0, LispWorks can be initialized again. It is possible to quit and restart LispWorks several times, at the same address or at a different address. - On Linux, Macintosh, FreeBSD and x86/x64 Solaris, you can create C wrappers to `InitLispWorks` and add them to the dynamic library using `dll-added-files` in `deliver` and `save-image`. - `InitLispWorks` is defined in each LispWorks dynamic library. ``` -------------------------------- ### Bypass All LispWorks Initialization Files Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-starting-lw-ug-2 Command-line option to start LispWorks without loading either personal or site-wide initialization files. This ensures a completely clean LispWorks environment, useful for isolating problems or starting with a minimal setup. ```Shell lispworks -init - -siteinit - ``` -------------------------------- ### Lisp: Example of Scheduling a Repeating Timer Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-mp-131 This example demonstrates the process of creating a timer and then scheduling it to expire at a specific absolute time (15 minutes after program start) and subsequently repeat at a fixed interval (every 5 minutes) using the `schedule-timer-milliseconds` function. ```Lisp (setq timer (mp:make-timer 'print 10 *standard-output*)) ``` ```Lisp (mp:schedule-timer-milliseconds timer 900000 300000) ``` -------------------------------- ### LispWorks Trace :before Example: Accumulating Arguments Source: https://www.lispworks.com/documentation/lw81/lw/lw.htm/lw-tracer-ug-2 This example demonstrates how to use the `:before` keyword with `trace` to accumulate all arguments passed to the `fac` function across multiple calls into a global list `args-in-reverse`. It shows the initialization, the trace setup, and a call to the traced function. ```Lisp (setq args-in-reverse ()) ``` ```Lisp (trace (fac :before ((push (car *traced-arglist*) args-in-reverse)))) ``` ```Lisp (fac 3) ```