The settings in this structure reflect the settings show in the language
configuration dialog for languages constructed with this mixin. The
first controls the input for the language. The rest specify printing
controls for the language. The style 'print is the default
style, as normally used in the Racket REPL. The sharing field
determines if cycles and sharing in values are displayed when the value
is rendered. The insert newlines field determines if values in the repl
are formatted with write style-line printouts, or with
pretty-print multi-line printouts.

If debugging is enabled, it sets the current-eval handler to
one that annotates each evaluated program with debugging annotations.
Additionally, it sets the error-display-handler to show the
debugging annotations when an error is raised.

Specification: The result of this method controls how the module is attached to the
user’s namespace. If the method returns #t, the Racket
primitive namespace-require/copy is used and if it returns
#f, namespace-require is used.
Default implementation: Returns #f by default.

This method used by the language configuration dialog to construct the
“details” panel for this language. It accepts a parent panel and
returns a get/set function that either updates the GUI to the argument
or returns the settings for the current GUI.

This method creates an executable in the given language. The
program-filename is the name of the program to store in the
executable and executable-filename is the name of a file
where the executable goes.

Calling this method should not escape. DrRacket calls this method in
a parameterize where the error-escape-handler is set
to an escaping continuation that continues initializing the
interactions window. Thus, raising an exception will report the error
in the user’s interactions window as if this were a bug in the user’s
program. Escaping in any other way, however, can cause DrRacket to
fail to start up.

Also, IO system will deadlock if the first-opened method does
IO on the user’s IO ports, so the calling context of
first-opened sets the current-output-port and
current-error-port to ports that just collect all of the IO
that happened and then replay it later in the initialization of the
user’s program.

Contrary to the method contract spec, DrRacket will also invoke this
method if it has zero arguments, passing nothing; the zero argument
version is for backwards compatibility and is not recommended.

front-end/complete-program method reads and parses a program
in the language. The port argument contains all of the data
to be read (until eof) and the name of the port (obtained via
object-name) is a value representing the source of the
program (typically an editor, but may also be a string naming a file
or some other value). The settings argument is the current
settings for the language.

The front-end/complete-program method is expected to return a
thunk that is called repeatedly to get all of the expressions in the
program. When all expressions have been read, the thunk is expected to
return eof.

This method is only called for programs in the definitions
window. Notably, it is not called for programs that are
loaded or evaled. See current-load and
current-eval for those.

This method is expected to raise an appropriate exception if the
program is malformed, eg an exn:syntax or exn:read.

This is called on the user’s thread, as is the thunk it returns.

Implementations of this method should not return fully expanded
expressions, since there are two forms of expansion, using either
expand or expand-top-level-with-compile-time-evals
and the use of the expanded code dictates which applies.

This method is called when Run is clicked, but only after
front-end/complete-program has
been called. Specifically, front-end/complete-program is first called to get a thunk that reads
from the program. That thunk is called some number of times,
eventually returning eof, or raising an exception. Then, this
method is called.

This method is called on the user’s main eventspace thread, and
without a prompt or other control delimiter. It must return without
raising an error, or else the DrRacket window will be wedged.

This method is just like
front-end/complete-program
except that it is called with program fragments, for example the
expressions entered in the interactions window. It is also used in
other contexts by tools to expand single expressions.

Returns text to be used for the “Insert Large Letters” menu item in
DrRacket. The first result is a prefix to be placed at the beginning
of each line and the second result is a character to be used for each
pixel in the letters.

Each element in the list indicates how the names at that point in
dialog will be sorted. Names with lower numbers appear first. If two
languages are added to DrRacket with the same strings (as given by the
get-language-position method)
the corresponding numbers returned by this method must be the same.
Additionally, no two languages can have the same set of numbers.

(Note: this method should always return the same result, for the same
language.)

This method returns a list of strings that is used to organize this
language with the other languages. Each entry in that list is a
category or subcategory of the language and the last entry in the list
is the name of the language itself. In the language dialog, each
element in the list except for the last will be a nested turn down
triangle on the left of the dialog. The final entry will be the name
that the user can choose to select this language. Names that are the
same will be combined into the same turndown entry.

It is expected to return a string that contains N lines, where N is
the result of calling
get-metadata-lines.
The string is prefixed to the buffer before the file is saved by
DrRacket, and removed from the buffer after it is opened in DrRacket.

The string is expect to be a prefix to the file that sets up a reader
for files in this language, using #reader.

The modname argument’s printed form is the same as the file’s
name, but without the path, and without an extension. The
settings argument is the current language’s settings value.

The result of the method is a count of the number of lines in the
strings that get-metadata
returns. The get-metadata
function does not necessarily return the same string each time it is
called (see metadata->settings)
but it is expected to always return a string with a fixed number of
lines, as indicated by the result of this method.

If the result is a sexp, saved files get a prefix inserted at the
beginning (the prefix is determined by calling
get-metadata). When the file
is then loaded, DrRacket recognizes this prefix and sets the language
back to match the saved file.

When a file is opened in DrRacket, if this language’s
get-reader-module returns an
sexp, the prefix of the file (the first N lines, where N is the number
returned by get-metadata-lines)
is scanned for "#reader" followed by the result of
get-reader-module. If that
pattern is found, the language is set to this language. Also, the
entire prefix is passed, as a string, to this method which returns a
settings value, used as the settings for this language.

The on-execute method is called on DrRacket’s eventspace’s
main thread before any evaluation happens when the Run button is
clicked. It is also called when a new DrRacket tab (or window) is
created to initialize the empty interactions window.

Use this method to initialize Racket’s
Parameters
for the user. When this function is called, the user’s thread has
already been created, as has its custodian. These parameters have
been changed from the defaults in Racket:

The port-write-handler and port-display-handler
have been set to procedures that call pretty-print and
pretty-display instead of write and
display. When pretty-print and
pretty-display are called by these parameters, the
pretty-print-columns parameter is set to
'infinity, so the output looks just like write and
display. This is done so that special scheme values can be
displayed as snips.

The current-print-covert-hook is to a procedure so that
snip%s are just returned directly to be inserted into the
interactions text% object.

The snip-class-list, returned by get-the-snip-class-list
is initialized with all of the snipclasses in DrRacket’s
eventspace’s snip-class-list.

The error-print-source-location parameter is set to
#f and the error-display-handler is set to a
handler that creates an error message from the exception record,
with font and color information and inserts that error message into
the definitions window.

The run-on-user-thread arguments accepts thunks and runs them
on the user’s eventspace’s main thread. The output ports are not yet
functioning, so print outs should be directed to the original DrRacket
output port, if necessary.

This thunk is wrapped in a with-handlers that catches all
exceptions matching exn:fail? and then prints out the
exception message to the original output port of the DrRacket process.

If the list of three strings alternative is used, the first string is
the prefix that is looked for when finding definitions. The second
and third strings are used as the label of the control, in horizontal
and vertical mode, respectively.

The pair of strings alternative is deprecated. If it is used,
the pair (consa-strb-str) is the same as (lista-strb-str"δ").

'drscheme:help-context-term:(or/cfalse/cstring?)=#f— specifies a context query for documentation searches that are
initiated in this language, can be #f (no change to the
user’s setting) or a string to be used as a context query (note: the
context is later maintained as a cookie, "" is different
from #f in that it clears the stored context)

'drscheme:special:insert-fraction:boolean?=#t— determines if the insert fraction menu item in the special menu is
visible

'drscheme:special:insert-lambda:boolean?=#t— determines if the insert lambda menu item in the special menu is
visible

'drscheme:special:insert-large-letters:boolean?=#t— determines if the insert large letters menu item in the special menu
is visible

'drscheme:special:insert-image:boolean?=#t— determines if the insert image menu item in the special menu is
visible

'drscheme:special:insert-comment-box:boolean?=#t— determines if the insert comment box menu item in the special menu
is visible

'drscheme:special:insert-gui-tool:boolean?=#t— determines if the insert gui menu item in the special menu is
visible

'drscheme:special:slideshow-menu-item:boolean?=#t— determines if the insert pict box menu item in the special menu is
visible

'drscheme:special:insert-text-box:boolean?=#t— determines if the insert text box menu item in the special menu is
visible

'drscheme:special:xml-menus:boolean?=#t— determines if the insert scheme box, insert scheme splice box, and
the insert xml box menu item in the special menu are visible

'drscheme:autocomplete-words:(listofstring?)='()— determines the list of words that are used when completing words in
this language

'drscheme:tabify-menu-callback:(or/cfalse/c(->(is-a?/ctext%)number?number?void?))=(λ(tab)(sendttabify-selectionab))— is used as the callback when the “Reindent” or “Reindent All”
menu is selected. The first argument is the editor, and the second
and third are a range in the editor.

Registers a handler to convert values into snips as they are printed in the REPL.

The test-snip argument is called to determine if this handler can convert the value
and the convert-value argument is called to build a snip.
The (optional) setup-thunk is called just after the user’s namespace and other
setings are built, but before any of the user’s code is evaluated.

All three functions are called on the user’s thread and with the user’s settings.

The default-implementation is a mixin
that provides a default implementation of
interface. Languages that are unaware of
the specifics of extension use
default-implementation via
drracket:language:get-default-mixin.

Calls the GRacket primitive
put-file
with arguments appropriate for creating an executable
from the file program-filename.

The arguments mred? and mode indicates
what type of executable this should be (and the dialog
may be slightly different on some platforms, depending
on these arguments). For historical reasons, #f
is allowed for mode as an alias for 'launcher, and
#t is allowed for mode as an alias for 'stand-alone.

Opens a dialog to prompt the user about their choice of executable.
If show-type is #t, the user is prompted about
a choice of executable: stand-alone,
launcher, or distribution; otherwise, the symbol determines the type.
If show-base
is #t, the user is prompted about a choice of base
binary: mzscheme or mred; otherwise the symbol determines the base.

The program-name argument is used to construct the default
executable name in a platform-specific manner.

The parent argument is used for the parent of the dialog.

The result of this function is #f if the user cancel’s
the dialog and a list of three items indicating what options
they chose. If either show-type or show-base
was not #t, the corresponding result will be 'no-show,
otherwise it will indicate the user’s choice.

This procedure creates a stand-alone executable in the file
executable-filename that runs the program
program-filename.

The arguments
module-language-spec and
transformer-module-language-spec specify the
settings of the initial namespace, both the transformer
portion and the regular portion. Both may be #f
to indicate there are no initial bindings.

The init-code argument is an s-expression representing
the code for a module. This module is expected to provide
the identifier init-code, bound to a procedure of no
arguments. That module is required and the init-code
procedure is executed to initialize language-specific
settings before the code in program-filename runs.

The gui? argument indicates if a GRacket or Racket
stand-alone executable is created.

Creates a distribution where the given
make-executable procedure
creates the stand-alone executable to be distributed.
The make-executable procedure is given the name of the
executable to create. The gui? argument is needed in case the
executable’s name (which drracket:language:create-distribution-for-executable
must generate) depends on the type of executable. During the distribution-making
process, a progress dialog is shown to the user, and the user can click an
Abort button that sends a break to the current thread.

The result can be either one or two values. The first result is
the converted value. The second result is #t if the converted
value should be printed with write (or pretty-write),
#f if the converted result should be printed with
print (or pretty-print); the default second
result is #t.

The result of this function depends on the
simple-settings-printing-style field of settings.
If it is 'print, the
result is (valuesvalue#f). If it is 'write or 'trad-write,
the result is just value. Otherwise, the result is produce by
adjusting the constructor-style-printing and show-sharing
parameters based on settings, setting current-print-convert-hook
to ignore snips, and then applying print-convert to value.

Returns a procedure that accepts three arguments: a thunk, settings, and
a pretty-print width. The result procedure, when invoked sets all of the
pretty-print and print-convert parameters
either to the defaults to values based on settings
and then invokes thunk, returning what it returns.