For the complete documentation index, see llms.txt. This page is also available as Markdown.

(lisppad system ios)

Library (lisppad system ios) implements a simple API for LispPad Go-specific system procedures. Procedures matching the same functionality on macOS are also available via library (lisppad system).

Files

(project-directory)

Returns the path to the documents directory of LispPad Go, where local files are stored.

(icloud-directory)

Returns the path to the iclouds directory of LispPad Go, where files are stored that are synchronized via iCloud. This procedure returns #f if iCloud synchronization is not enabled.

(icloud-list)

Returns a list of file paths of all LispPad-related files that are synchronized via iCloud. The paths are relative to the iCloud directory which can be obtained via procedure icloud-directory.

(preview-file path)

Shows a preview of the content of the file at the given file path path. Supported are many different types of files, including text files, images, PDF files, spreadsheets, etc.

(share-file path)

Shows a file share panel for the file at file path path, allowing the user to share the file with another application.

(open-in-files-app path)

Opens the Files app at the given file path path.

Images

(save-bitmap-in-library img)

Saves the given bitmap-based image img in the photo library of the user. The first time this procedure gets invoked, it asks the user for permission to access the photo library.

(load-bitmaps-from-library) (load-bitmaps-from-library max) (load-bitmaps-from-library max filter)

Opens an image selector showing the images of the user's photo library. The user can select up to max images from the photo library. These are returned by procedure load-bitmaps-from-library as a list of images. filter is an image filter for narrowing down the types of images that are shown. filter has either the form of:

  • a symbol, indicating a type of images (e.g. bursts, panoramas, videos),

  • (not filter ), indicating the inverse of filter,

  • (and filter ... ), indicating the conjunction of the given filters, or

  • (or filter ... ), indicating the disjunction of the given filters.

The following image type tags, expressed as a symbol, are supported: bursts, cinematic-videos, depth-effect-photos, images, live-photos, panoramas, screen-recordings, screenshots, slomo-videos, timelapse-videos, and videos. The default is images.

(load-bytevectors-from-library) (load-bytevectors-from-library max) (load-bytevectors-from-library max filter)

Opens an image selector showing the images of the user's photo library. The user can select up to max images from the photo library. These are returned by procedure load-bytevectors-from-library as a list of bytevectors. filter is an image filter for narrowing down the types of images that are shown, as documented for procedure load-bitmaps-from-library. load-bytevectors-from-library is useful if one is dealing with videos or other types of data that are not supported natively.

Interaction

(show-message-panel title) (show-message-panel title message) (show-message-panel title message button)

Shows a message panel (an alert) with the given title and message, and a single button labeled button for dismissing it. If title is #f, the title "Alert" is used. If message is not provided or #f, no message text is shown. If button is not provided or #f, the button is labeled "OK". show-message-panel returns an unspecified value once the panel was dismissed by the user, or #f if the panel could not be displayed.

(show-confirmation-panel title message) (show-confirmation-panel title message yes) (show-confirmation-panel title message yes no)

Shows a confirmation panel with the given title and message, providing two buttons for confirming (labeled yes) or rejecting (labeled no) the request. If title is #f, the title "Confirm" is used. If yes is not provided or #f, the confirmation button is labeled "Yes". If no is not provided or #f, the rejection button is labeled "No". Procedure show-confirmation-panel returns #t if the user confirms the request, and #f if the user rejects it or the panel could not be displayed.

(show-choice-panel title message options) (show-choice-panel title message options selected) (show-choice-panel title message options selected confirm)

Shows a choice panel with the given title and message, letting the user pick one alternative from list options. Each element of options is either a string, or a pair whose first component is a string used as the label of the alternative. selected is a string identifying the label of the alternative that is selected initially; if selected is not provided or #f, no alternative is pre-selected. confirm is the label of the button used to confirm the selection; the default is "Select". Procedure show-choice-panel returns the zero-based index of the alternative chosen by the user within options, or #f if the choice was cancelled or the panel could not be displayed.

(show-input-panel title message) (show-input-panel title message initial) (show-input-panel title message initial placeholder) (show-input-panel title message initial placeholder confirm)

Shows an input panel with the given title and message, letting the user enter a line of text. initial is the text shown initially in the input field; the default is the empty string. placeholder is a placeholder text shown when the input field is empty; the default is the empty string. confirm is the label of the button used to confirm the input; the default is "OK". Procedure show-input-panel returns the string entered by the user, or #f if the input was cancelled or the panel could not be displayed.

(show-date-panel title message type) (show-date-panel title message type initial) (show-date-panel title message type initial range) (show-date-panel title message type initial range tz) (show-date-panel title message type initial range tz confirm) (show-date-panel title message type initial range tz confirm cancel)

Shows a date panel with the given title and message, letting the user pick a date, a range of dates, or several dates, depending on type. type is one of the symbols single, range, or multiple:

  • If type is single, initial is either #f (no date pre-selected) or a date-time object representing the initially selected date. show-date-panel returns a date-time object for the date picked by the user, or #f if the panel was cancelled.

  • If type is range, initial is either #f (no range pre-selected) or a pair of two date-time objects representing the lower and upper bound of the initially selected range. show-date-panel returns a pair of two date-time objects for the range picked by the user, or #f if the panel was cancelled.

  • If type is multiple, initial is either #f (no dates pre-selected) or a list of date-time objects representing the initially selected dates. show-date-panel returns a list of date-time objects for the dates picked by the user, or #f if the panel was cancelled.

range restricts the dates that can be selected to a given interval. It is either #f (no restriction) or a pair of two date-time objects representing the lower and upper bound of the selectable interval. tz specifies the time zone used for interpreting and returning date-time values. It is either #f (the current, operating-system defined time zone is used), a number representing an offset from GMT in seconds, a symbol referring to a time zone abbreviation (e.g. PST), or a string referring to a time zone identifier (e.g. "America/Los_Angeles") or a time zone abbreviation. If title or message is #f, no title, respectively no message, is shown. confirm and cancel are the labels of the buttons used to confirm (default "Select") and cancel (default "Cancel") the panel. Procedure show-date-panel also returns #f if the panel could not be displayed.

(show-preview-panel obj) (show-preview-panel obj type)

Shows a preview of obj when possible. Supported are the following types of data: strings (textual data), bytevectors (binary data), styled text, images, and drawings. For strings and bytevectors it is important that parameter type is used to narrow down the type of content. type is a string representing a "file extension". Supported are at least: "png", "jpg", "jpeg", "gif", "bmp", "tif", "tiff", "text", "txt", "markdown", "md", "html", "rtf", and "rtfd". Other type extensions might work.

(show-share-panel obj) (show-share-panel obj type)

Shows a panel for sharing obj with other applications when possible. Supported are the following types of data: strings (textual data), bytevectors (binary data), styled text, images, and drawings. For strings and bytevectors it is important that parameter type is used to narrow down the type of content. type is a string representing a "file extension". Supported are at least: "png", "jpg", "jpeg", "gif", "bmp", "tif", "tiff", "text", "txt", "markdown", "md", "html", "rtf", and "rtfd". Other type extensions might work.

(show-load-panel prompt folders filetypes)

Displays a file load panel with the given prompt message. folders is a boolean argument; it should be set to #t if the user is required to select a folder. filetypes is a list of suffixes of selectable file types.

(show-save-panel prompt) (show-save-panel prompt path) (show-save-panel prompt path locked)

Displays a file save panel with the given prompt message. path might refer to a pre-selected file. Boolean argument locked determines if the folder (provided via path) may be changed or not.

(show-interpreter-tab tab) (show-interpreter-tab tab canvas)

LispPad Go has three interpreter views: the console view, the log view, and the canvas view. Procedure show-interpreter-tab enables programmatic navigation between these three views. tab is one of the following three symbols: console, log, and canvas. If tab is canvas, then a second argument canvas can be provided referring to a canvas to select.

(show-help name)

Shows documentation for identifier name (symbol or string), if available.

Canvases

A canvas shows a drawing in the canvas view of the interpreter. The following parameters can be configured for every canvas: the drawing, the size of the canvas, a scale factor (default is 1.0), and an optional background color. Canvases are identified by a fixnum identifier.

(make-canvas drawing size) (make-canvas drawing size name) (make-canvas drawing size name color)

Creates a new canvas of size showing drawing. String name is used to identify the canvas in the user interface. If name is not provided, a unqiue name is generated. color is the background color of the new canvas. make-canvas returns a canvas identifier (fixnum), which is used to refer to canvases in the API.

(use-canvas drawing size) (use-canvas drawing size name) (use-canvas drawing size name color)

Creates or reuses a canvas of size showing drawing. If there is already an existing canvas of the same name, it is reused and reconfigured. Otherwise, a new canvas is created. color is the background color of the canvas. use-canvas returns a canvas identifier (fixnum), which is used to refer to canvases in the API.

(close-canvas canvas)

Closes canvas. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). close-canvas returns #t if a canvas was closed, otherwise #f is returned.

(canvas-name canvas)

Returns the name of canvas as a string. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(set-canvas-name! canvas name)

Sets the name of canvas to string name. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(canvas-size canvas)

Returns the size of canvas. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(set-canvas-size! canvas size)

Sets the size of canvas to size. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(canvas-scale canvas)

Returns the scale factor used by canvas. The default is 1.0. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(set-canvas-scale! canvas scale)

Sets the scale factor used by canvas to number scale. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(canvas-background canvas)

Returns the background color of canvas if one was defined, or #f if no background color was set. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(set-canvas-background! canvas color)

Sets the background color of canvas to color (color or #f). canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(canvas-drawing canvas)

Returns the drawing shown by canvas. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

(set-canvas-drawing! canvas drawing)

Sets the background color of canvas to drawing. canvas is either a canvas identifier (fixnum) or it is a name of a canvas (string). It is an error if no matching canvas was found.

Sessions

(session-id)

Returns a unique fixnum (within LispPad Go) identifying the interpreter session. The number changes when the interpreter is reset or the application is restarted.

(session-name)

Returns the name of the LispPad session which executes this function. This name is customizable on macOS. On iOS, the name is generated using the session id.

(session-log time sev str) (session-log time sev str tag)

Logs the message str with severity sev at the given timestamp time (a double value) in the session log. sev is one of the following symbols: debug, info, warn, error, or fatal.

Environment

(screen-size)

Returns the screen size of the screen of the device running LispPad Go.

(dark-mode?)

Return #t if the device on which LispPad Go is running is using dark mode; returns #f otherwise.

Last updated