1 Implementing Dr Scheme Tools
2 Adding Languages to Dr Scheme
3 Creating New Kinds of Dr Scheme Frames
4 Extending the Existing Dr Scheme Classes
5 Expanding the User’s Program Text and Breaking
6 Editor Modes
7 Language-specific capabilities
8 drscheme: get/ extend
9 drscheme: unit
10 drscheme: language
11 drscheme: language-configuration
12 drscheme: debug
13 drscheme: rep
14 drscheme: frame
15 drscheme: help-desk
16 drscheme: eval
17 drscheme: modes
Index
On this page:
drscheme: language: simple-module-based-language<%>
get-language-numbers
get-language-position
get-module
get-one-line-summary
get-reader
drscheme: language: simple-module-based-language%
get-language-numbers
get-language-position
get-module
get-one-line-summary
get-reader
drscheme: language: simple-module-based-language->module-based-language-mixin
config-panel
default-settings
default-settings?
get-init-code
get-transformer-module
marshall-settings
on-execute
render-value
render-value/ format
unmarshall-settings
use-mred-launcher
drscheme: language: module-based-language<%>
config-panel
default-settings
default-settings?
get-init-code
get-language-numbers
get-language-position
get-module
get-one-line-summary
get-reader
get-transformer-module
marshall-settings
on-execute
render-value
render-value/ format
unmarshall-settings
use-mred-launcher
use-namespace-require/ copy?
drscheme: language: module-based-language->language-mixin
front-end/ complete-program
front-end/ interaction
get-language-name
on-execute
drscheme: language: language<%>
capability-value
config-panel
create-executable
default-settings
default-settings?
first-opened
front-end/ complete-program
front-end/ interaction
get-comment-character
get-language-name
get-language-numbers
get-language-position
get-language-url
get-metadata
get-metadata-lines
get-one-line-summary
get-reader-module
get-style-delta
marshall-settings
metadata->settings
on-execute
order-manuals
render-value
render-value/ format
unmarshall-settings
drscheme: language: object/ c
drscheme: language: register-capability
drscheme: language: capability-registered?
drscheme: language: get-capability-default
drscheme: language: get-capability-contract
drscheme: language: add-snip-value
drscheme: language: extend-language-interface
drscheme: language: get-default-mixin
drscheme: language: get-language-extensions
drscheme: language: put-executable
drscheme: language: create-executable-gui
drscheme: language: create-module-based-stand-alone-executable
drscheme: language: create-module-based-distribution
drscheme: language: create-distribution-for-executable
drscheme: language: create-module-based-launcher
drscheme: language: text/ pos-text
drscheme: language: text/ pos-start
drscheme: language: text/ pos-end
drscheme: language: text/ pos?
drscheme: language: make-text/ pos
drscheme: language: simple-settings-case-sensitive
drscheme: language: simple-settings-printing-style
drscheme: language: simple-settings-fraction-style
drscheme: language: simple-settings-show-sharing
drscheme: language: simple-settings-insert-newlines
drscheme: language: simple-settings-annotations
drscheme: language: simple-settings?
drscheme: language: make-simple-settings
drscheme: language: simple-settings->vector
Version: 4.0.2

 

10 drscheme:language

drscheme:language:simple-module-based-language<%> : interface?

This interface represents the bare essentials when defining a module-based language. Use the drscheme:language:simple-module-based-language->module-based-language-mixin mixin to construct an implementation of drscheme:language:module-based-language<%> from an implementation of this interface.

The class drscheme:language:simple-module-based-language% provides an implementation of this interface.

(send a-drscheme:language:simple-module-based-language get-language-numbers)

  (cons number (listof number))

Returns a list of numbers, whose length must be the same as the result of get-language-position. Each number indicates the sorted order of the language positions in the language dialog.

(send a-drscheme:language:simple-module-based-language get-language-position)

  (cons string (listof string))

This method is the same as get-language-position.

(send a-drscheme:language:simple-module-based-language get-module)

  s-expression

This method specifies the module that defines the language.

This method replaces front-end/complete-program and front-end/interaction.

The result is expected to be the module (its initial require) except as value, ie quoted.

(send a-drscheme:language:simple-module-based-language get-one-line-summary)

  string?

The result of this method is shown in the language dialog when the user selects this language.

(send a-drscheme:language:simple-module-based-language get-reader)

  (->* () (any/c input-port?) (or/c syntax? eof-object?))

This method must return a procedure that is used to read syntax from a port in the same manner as read-syntax. It is used as the reader for this language.

drscheme:language:simple-module-based-language% : class?

  superclass: object%

  extends: 

drscheme:language:simple-module-based-language<%>

(make-object drscheme:language:simple-module-based-language%

 

 

 

module

 

 

 

language-position

 

 

 [

language-numbers

 

 

 

one-line-summary

 

 

 

documentation-reference]

 

 

 

reader

 

 

 

language-id)

 

  (is-a?/c drscheme:language:simple-module-based-language%)

  module : s-expression

  language-position : (cons string (listof string))

  

language-numbers

 

:

 

(cons number (listof number))

 

 

 

=

 

(map (lambda (x) 0) language-position)

  one-line-summary : string? = ""

  documentation-reference : (or/c false/c something-else) = #f

  reader : (->* () (any/c input-port?) (or/c syntax? eof-object?))

  language-id : string?

The init args are used as the results of the get-module and get-language-position methods

(send a-drscheme:language:simple-module-based-language get-language-numbers)

  (cons number (listof number))

Overrides get-language-numbers in drscheme:language:simple-module-based-language<%>.

returns the corresponding init arg.

(send a-drscheme:language:simple-module-based-language get-language-position)

  s-expression

Overrides get-language-position in drscheme:language:simple-module-based-language<%>.

returns the corresponding init arg.

(send a-drscheme:language:simple-module-based-language get-module)

  (cons string (listof string))

Overrides get-module in drscheme:language:simple-module-based-language<%>.

returns the corresponding init arg.

(send a-drscheme:language:simple-module-based-language get-one-line-summary)

  string?

Overrides get-one-line-summary in drscheme:language:simple-module-based-language<%>.

returns the corresponding initialization argument.

(send a-drscheme:language:simple-module-based-language get-reader)

  (->* () (any/c input-port?) (or/c syntax? eof-object?))

Overrides get-reader in drscheme:language:simple-module-based-language<%>.

returns the corresponding init arg.

drscheme:language:simple-module-based-language->module-based-language-mixin : (class? . -> . class?)

  argument extends/implements: 

drscheme:language:simple-module-based-language<%>

  result implements: 

drscheme:language:module-based-language<%>

This mixin uses a struct definition for its settings:

  (define-struct drscheme:language:simple-settings

    (case-sensitive  ; boolean?

     printing-style  ; (symbols 'constructor 'quasiquote 'write 'print)

     fraction-style  ; (symbols 'mixed-fraction 'mixed-fraction-e

                     ; 'repeating-decimal 'repeating-decimal-e)

     show-sharing    ; boolean?

     insert-newlines ; boolean?

     annotations))   ; (symbols 'none 'debug 'debug/profile

                     ; 'test-coverage)

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 'write is the default style, used in the MzScheme 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.

(send a-drscheme:language:simple-module-based-language->module-based-language config-panel)

  (case-> (-> settings) (settings -> void))

Overrides <method not found>.

Constructs a configuration panel that lets the user configure all of the settings for this language.

See also drscheme:language:simple-module-based-language->module-based-language-mixin for details of the simple-settings structure, this mixin’s settings type.

(send a-drscheme:language:simple-module-based-language->module-based-language default-settings)

  settings

Overrides <method not found>.

The defaults for the settings are

  • case-sensitive is #f

  • printing-style is 'write

  • show-sharing is #f

  • insert-newlines is #t

See also drscheme:language:simple-module-based-language->module-based-language-mixin for details of the simple-settings structure, this mixins settings type.

(send a-drscheme:language:simple-module-based-language->module-based-language default-settings?)

  boolean?

Overrides <method not found>.

(send a-drscheme:language:simple-module-based-language->module-based-language get-init-code settings)

  sexpression

  settings : settings

Overrides <method not found>.

Creates an s-expression of a module that sets the current-inspector, read-case-sensitive, and error-value->string parameters. Additionally, it may load errortrace, if debugging is enabled.

(send a-drscheme:language:simple-module-based-language->module-based-language get-transformer-module)

  s-expression

Overrides <method not found>.

Returns 'mzscheme.

(send a-drscheme:language:simple-module-based-language->module-based-language marshall-settings)

  writable

Overrides <method not found>.

Constructs a vector from the structure.

See also drscheme:language:simple-module-based-language->module-based-language-mixin for details of the simple-settings structure, this mixins settings type.

(send a-drscheme:language:simple-module-based-language->module-based-language on-execute)

  void?

Overrides <method not found>.

Sets the case sensitivity of the language.

Sets the structure inspector to a new inspector, saving the original inspector for use during printing.

Sets the global-port-print-handler to print based on the settings structure, but without any newlines.

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.

See also drscheme:language:simple-module-based-language->module-based-language-mixin for details of the simple-settings structure, this mixin’s settings type.

(send a-drscheme:language:simple-module-based-language->module-based-language render-value)

  void?

Overrides <method not found>.

Translates the value to a string, based on the settings.

Restores a super struct inspector to render structs properly. (See also on-execute)

See also drscheme:language:simple-module-based-language->module-based-language-mixin for details of the simple-settings structure, this mixin’s settings type.

(send a-drscheme:language:simple-module-based-language->module-based-language render-value/format)

  void?

Overrides <method not found>.

Translates the value to a string, based on the settings.

Restores a super struct inspector to render structs properly. (See also on-execute)

See also drscheme:language:simple-module-based-language->module-based-language-mixin for details of the simple-settings structure, this mixin’s settings type.

(send a-drscheme:language:simple-module-based-language->module-based-language unmarshall-settings)

  (or/c false/c settings)

Overrides <method not found>.

Builds a settings structure from the vector, or #f if the vector doesn’t match the types of the structure.

See also drscheme:language:simple-module-based-language->module-based-language-mixin for details of the simple-settings structure, this mixin’s settings type.

(send a-drscheme:language:simple-module-based-language->module-based-language use-mred-launcher)

  boolean?

Overrides <method not found>.

Returns #t.

drscheme:language:module-based-language<%> : interface?

This interface is for languages that can be implemented with MzScheme modules.

Use the drscheme:language:module-based-language->language-mixin mixin to construct an implementation of drscheme:language:language<%> from an implementation of this interface.

(send a-drscheme:language:module-based-language config-panel parent)

  (case-> (-> settings) (settings -> void))

  parent : (is-a?/c panel%)

This method is the same as config-panel.

(send a-drscheme:language:module-based-language default-settings)

  settings

This method is the same as default-settings.

(send a-drscheme:language:module-based-language default-settings? settings)

  boolean?

  settings : settings

This method is the same as default-settings?.

(send a-drscheme:language:module-based-language get-init-code settings)

  sexp

  settings : settings

Returns a module in sexpression form that is used for creating executables. The module must provide a thunk, called init-code.

When either a stand-alone executable or a launcher is created, the module is required, and init-code is invoked. This procedure is expected to set up the environment, based on the settings.

(send a-drscheme:language:module-based-language get-language-numbers)

  (cons number (listof number))

This method is the same as get-language-numbers.

(send a-drscheme:language:module-based-language get-language-position)

  (cons string (listof string))

This method is the same as get-language-position.

(send a-drscheme:language:module-based-language get-module)

  s-expression

This method specifies the module that defines the language. It is used to initialize the user’s namespace.

The result is expected to be the module (its initial require) except as value, ie quoted.

See also get-transformer-module.

(send a-drscheme:language:module-based-language get-one-line-summary)

  string?

The result of this method is shown in the language dialog when the user selects this language.

(send a-drscheme:language:module-based-language get-reader)

  (->* () (any/c input-port?) (or/c syntax? eof-object?))

This method must return a procedure that is used to read syntax from a port in the same manner as read-syntax. It is used as the reader for this language.

(send a-drscheme:language:module-based-language get-transformer-module)

  (or/c quoted-module-path (scheme #f))

This method specifies the module that defines the transformation language. It is used to initialize the transformer portion of the user’s namespace.

The result is expected to be the module (its initial require) except as value, ie quoted or #f.

If the result is #f, no module is required into the transformer part of the namespace.

See also get-module.

(send a-drscheme:language:module-based-language marshall-settings settings)

  writable

  settings : settings

This method is the same as marshall-settings.

(send a-drscheme:language:module-based-language on-execute

 

 

 

settings

 

 

 

run-in-user-thread)

 

  vod

  settings : settings

  run-in-user-thread : ((-> void) -> void)

This method is the same as on-execute.

(send a-drscheme:language:module-based-language render-value

 

 

 

value

 

 

 

settings

 

 

 

port)

 

  void?

  value : TST

  settings : settings

  port : port

This method is the same as render-value.

(send a-drscheme:language:module-based-language render-value/format

 

 

 

value

 

 

 

settings

 

 

 

port

 

 

 

width)

 

  void?

  value : TST

  settings : settings

  port : port

  width : (or/c number (symbols 'infinity))

This method is the same as render-value/format.

(send a-drscheme:language:module-based-language unmarshall-settings input)

  (or/c settings false/c)

  input : writable

This method is the same as unmarshall-settings.

(send a-drscheme:language:module-based-language use-mred-launcher)

  boolean?

This method is called when an executable is created to determine if the executable should use the mred or the mzscheme binary.

(send a-drscheme:language:module-based-language use-namespace-require/copy?)

  boolean?

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

Default implementation: Defaultly returns #f.

drscheme:language:module-based-language->language-mixin : (class? . -> . class?)

  argument extends/implements: 

drscheme:language:module-based-language<%>

  result implements: 

drscheme:language:language<%>

(send a-drscheme:language:module-based-language->language front-end/complete-program)

  (-> (or/c sexp/c syntax? eof-object?))

Overrides <method not found>.

Reads a syntax object, from input. Does not use settings.

For languages that use these mixins, there is no difference between this method and front-end/interaction.

(send a-drscheme:language:module-based-language->language front-end/interaction)

  (-> (or/c sexp/c syntax? eof-object?))

Overrides <method not found>.

Reads a syntax object, from input. Does not use settings.

For languages that use these mixins, there is no difference between this method and front-end/complete-program.

(send a-drscheme:language:module-based-language->language get-language-name)

  string?

Overrides <method not found>.

Returns the last element of the list returned by get-language-position.

(send a-drscheme:language:module-based-language->language on-execute)

  void?

Overrides on-execute in drscheme:language:module-based-language<%>.

Calls the super method.

Uses namespace-require to install the result of get-module and Uses namespace-transformer-require to install the result of get-transformer-module into the user’s namespace.

drscheme:language:language<%> : interface?

Implementations of this interface are languages that DrScheme supports.

See Adding Languages to DrScheme for an overview of adding languages to DrScheme.

(send a-drscheme:language:language capability-value key)  any

  key : symbol

Specification: Returns the language-specific value for some capability. See also drscheme:language:register-capability.

Default implementation: Defaultly returns the value from: drscheme:language:get-capability-default.

(send a-drscheme:language:language config-panel parent)

  (case-> (-> settings) (settings -> void))

  parent : (is-a?/c panel%)

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.

(send a-drscheme:language:language create-executable

 

 

 

settings

 

 

 

parent

 

 

 

program-filename)

 

  void?

  settings : settings

  parent : (or/c (is-a?/c dialog%) (is-a?/c frame%))

  program-filename : string?

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.

See also drscheme:language:create-module-based-stand-alone-executable and drscheme:language:create-module-based-launcher.

(send a-drscheme:language:language default-settings)

  settings

Specifies the default settings for this language.

(send a-drscheme:language:language default-settings? settings)

  boolean?

  settings : settings

Return #t if the input settings matches the default settings obtained via default-settings.

(send a-drscheme:language:language first-opened)  void?

This method is called when the language is initialized, but no program is run. It is called from the user’s eventspace’s main thread.

See also initialize-console.

(send a-drscheme:language:language front-end/complete-program

 

 

 

port

 

 

 

settings)

 

  (-> (or/c sexp/c syntax? eof-object?))

  port : port

  settings : settings

front-end/complete-program method reads, parses, and optionally compiles a program in the language. The first argument contains all of the data to be read (until eof) and the second argument 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 third 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.

See also front-end/interaction.

(send a-drscheme:language:language front-end/interaction

 

 

 

port

 

 

 

settings)

 

  (-> (or/c sexp/c syntax? eof-object?))

  port : input-port

  settings : settings

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.

(send a-drscheme:language:language get-comment-character)

 

 

string?

 

char?

Returns text to be used for the “Insert Large Letters” menu item in DrScheme. 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.

(send a-drscheme:language:language get-language-name)

  string?

Returns the name of the language, as shown in the REPL when executing programs in the language and in the bottom left of the drscheme window.

(send a-drscheme:language:language get-language-numbers)

  (cons number (listof number))

This method is used in a manner analogous to get-language-position.

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 DrScheme 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.)

(send a-drscheme:language:language get-language-position)

  (cons string (listof string))

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.

For example, if one language’s position is:

  (list "General Category" "Specific Category" "My Language")

and another’s is:

  (list "General Category" "Specific Category" "My Other Language")

The language dialog will collapse the first two elements in the list, resulting in only a pair of nested turn-down triangles, not parallel pairs of nested turn-down triangles.

(send a-drscheme:language:language get-language-url)

  (or/c string? false/c)

Specification: Returns a url for the language.

Default implementation: If the result isn’t #f, the name of the language is clickable in the interactions window and clicking takes you to this url.

(send a-drscheme:language:language get-metadata)  string?

This method is only called when get-reader-module returns an sexp.

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 DrScheme, and removed from the buffer after it is opened in DrScheme.

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

See also metadata->settings, get-metadata-lines, and get-reader-module.

(send a-drscheme:language:language get-metadata-lines)

  number

This method is only called when get-reader-module returns an sexp.

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.

(send a-drscheme:language:language get-one-line-summary)

  string?

Specification: The result of this method is shown in the language dialog when the user selects this language.

Default implementation:

(send a-drscheme:language:language get-reader-module)

  (or/c sexp-representing-a-require-spec false/c)

The result of this method is used when saving or loading files.

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, DrScheme recognizes this prefix and sets the language back to match the saved file.

See also metadata->settings, get-metadata-lines, and get-metadata.

(send a-drscheme:language:language get-style-delta)

  (or/c #f (is-a?/c style-delta%) (listof (list/c (is-a?/c style-delta%) number? number?)))

The style delta that this method returns is used in the language dialog and the DrScheme REPL when the language’s name is printed.

When it is #f, no styling is used.

If the result is a list, each element is expected to be a list of three items, a style-delta, and two numbers. The style delta will be applied to the corresponding portion of the name.

(send a-drscheme:language:language marshall-settings settings)

  writable

  settings : settings

Translates an instance of the settings type into a scheme object that can be written out to disk.

(send a-drscheme:language:language metadata->settings metadata)

  settings

  metadata : string?

This method is only called when get-reader-module returns an sexp.

When a file is opened in DrScheme, 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.

(send a-drscheme:language:language on-execute

 

 

 

settings

 

 

 

run-in-user-thread)

 

  any

  settings : settings

  run-in-user-thread : ((-> any) -> any)

The on-execute method is called on DrScheme’s eventspace’s main thread before any evaluation happens during execution. Use this method to initialize MzScheme’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 MzScheme:

The run-in-user-thread arguments accepts thunks and runs them on the user’s eventspace’s main thread. These thunks must not raise an exceptions (or drscheme itself will get stuck). In addition, the output ports are not yet functioning, so print outs should be directed to the original drscheme output port, if necessary.

(send a-drscheme:language:language order-manuals manuals)

 

 

(listof bytes?)

 

boolean?

  manuals : (listof bytes?)

Returns a sublist of its input, that specifies the manuals (and their order) to search in. The boolean result indicates if doc.txt files should be searched.

(send a-drscheme:language:language render-value

 

value

 

 

 

settings

 

 

 

port)

 

  void?

  value : TST

  settings : settings

  port : port

This method is just like render-value/format except that it is expected to put the entire value on a single line with no newline after the value.

(send a-drscheme:language:language render-value/format

 

 

 

value

 

 

 

settings

 

 

 

port

 

 

 

width)

 

  void?

  value : TST

  settings : settings

  port : port

  width : (or/c number (symbols 'infinity))

This method is used to print values into a port, for display to a user. The final argument is a maximum width to use (in characters) when formatting the value.

This method is expected to format the value by inserting newlines in appropriate places and is expected to render a newline after the value.

See also render-value.

(send a-drscheme:language:language unmarshall-settings input)

  (or/c settings false/c)

  input : writable

Translates a Scheme value into a settings, returning #f if that is not possible.

drscheme:language:object/c : contract?

  (object-contract

   (config-panel (-> (is-a?/c area-container<%>)

                     (case-> (-> any/c void?)

                             (-> any/c))))

   (create-executable (-> any/c

                          (or/c (is-a?/c dialog%) (is-a?/c frame%))

                          path?

                          void?))

   (default-settings (-> any/c))

   (default-settings? (-> any/c boolean?))

   (front-end/complete-program (-> input-port?

                                   any/c

                                   (-> any/c)))

   (front-end/interaction (-> input-port?

                              any/c

                              (-> any/c)))

   (get-language-name (-> string?))

   (get-language-numbers (-> (cons/c number? (listof number?))))

   (get-language-position (-> (cons/c string? (listof string?))))

   (get-language-url (-> (or/c false/c string?)))

   (get-one-line-summary (-> string?))

   (get-comment-character (-> (values string? char?)))

   (get-style-delta

    (-> (or/c false/c

              (is-a?/c style-delta%)

              (listof

               (list/c (is-a?/c style-delta%)

                       number?

                       number?)))))

   (marshall-settings (-> any/c printable/c))

   (on-execute (-> any/c (-> (-> any) any) any))

   (render-value (-> any/c

                     any/c

                     output-port?

                     void?))

   (render-value/format (-> any/c

                            any/c

                            output-port?

                            (or/c number? (symbols 'infinity))

                            any))

   (unmarshall-settings (-> printable/c any))

  

   (capability-value

    (->d ((s (and/c symbol?

                    drscheme:language:capability-registered?)))

         ()

         (res (drscheme:language:get-capability-contract s)))))

(drscheme:language:register-capability

 

s

 

 

 

 

 

 

the-contract

 

 

 

 

 

 

default)

 

 

void?

  s : symbol?

  the-contract : contract?

  default : the-contract

Registers a new capability with a default value for each language and a contract on the values the capability might have.

By default, these capabilities are registered as DrScheme starts up:

(drscheme:language:capability-registered? s)  boolean?

  s : symbol?

Indicates if drscheme:language:register-capability has been called with s.

(drscheme:language:get-capability-default s)

  (drscheme:language:get-capability-contract s)

  s : (and/c symbol? drscheme:language:capability-registered?)

Returns the default for a particular capability.

(drscheme:language:get-capability-contract s)  contract?

  s : (and/c symbol? drscheme:language:capability-registered?)

Returns the contract for a given capability, which was specified when drscheme:langauge:register-capability was called.

(drscheme:language:add-snip-value

 

test-value

 

 

 

 

 

 

convert-value

 

 

 

 

 

 [

setup-thunk])

 

 

void?

  test-value : (-> any/c boolean?)

  convert-value : (-> any/c (is-a?/c snip%))

  setup-thunk : (-> any/c) = void

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.

(drscheme:language:extend-language-interface

 

 

 

interface

 

 

 

default-implementation)

 

  void?

  interface : interface?

  default-implementation : (make-mixin-contract drscheme:language:language<%>)

This function can only be called in phase 1 (see Implementing DrScheme Tools for details).

Each language added passed to drscheme:language-configuration:add-language must implement interface.

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 drscheme:language:get-default-mixin.

(drscheme:language:get-default-mixin)

  (make-mixin-contract drscheme:language:language<%>)

This function can only be called in phase 2 (see Implementing DrScheme Tools for details).

The result of this function is the composite of all of the default-implementation arguments passed to drscheme:language:extend-language-interface.

(drscheme:language:get-language-extensions)

  (listof interface?)

This function can only be called in phase 2 (see Implementing DrScheme Tools for details).

Returns a list of the interfaces passed to drscheme:language:extend-language-interface.

(drscheme:language:put-executable

 

parent

 

 

 

program-filename

 

 

 

mode

 

 

 

mred?

 

 

 

title)

 

  (or/c false/c path?)

  parent : (is-a?/c top-level-window<%>)

  program-filename : path?

  mode : (or/c boolean? (symbols 'launcher 'standalone 'distribution))

  mred? : boolean?

  title : string?

Calls the MrEd 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.

The title argument is used as the title to the primitive put-file or get-directory primitive.

(drscheme:language:create-executable-gui

 

parent

 

 

 

program-name

 

 

 

show-type

 

 

 

show-base)

 

 

 

(or/c false/c

      (list/c (symbols 'no-show 'launcher 'stand-alone 'distribution)

              (symbols 'no-show 'mred 'mzscheme)

              string?))

  parent : (or/c false/c (is-a?/c top-level-window<%>))

  program-name : (or/c false/c string?)

  show-type : (or/c (λ (x) (eq? x #t)) (symbols 'launcher 'standalone 'distribution))

  show-base : (or/c (λ (x) (eq? x #t)) (symbols 'mzscheme 'mred))

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.

(drscheme:language:create-module-based-stand-alone-executable

 

 

 

program-filename

 

 

 

executable-filename

 

 

 

module-language-spec

 

 

 

transformer-module-language-spec

 

 

 

init-code

 

 

 

gui?

 

 

 

use-copy?)

 

  void?

  program-filename : (or/c path? string?)

  executable-filename : (or/c path? string?)

  module-language-spec : any/c

  transformer-module-language-spec : any/c

  init-code : any/c

  gui? : boolean?

  use-copy? : boolean?

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 identifer 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 MrEd or MzScheme stand-alone executable is created.

The use-copy? argument indicates if the initial namespace should be populated with namespace-require/copy or namespace-require.

(drscheme:language:create-module-based-distribution

 

 

 

program-filename

 

 

 

distribution-filename

 

 

 

module-language-spec

 

 

 

transformer-module-language-spec

 

 

 

init-code

 

 

 

gui?

 

 

 

use-copy?)

 

  void?

  program-filename : (or/c path? string?)

  distribution-filename : (or/c path? string?)

  module-language-spec : any/c

  transformer-module-language-spec : any/c

  init-code : any/c

  gui? : boolean?

  use-copy? : boolean?

Like drscheme:language:create-module-based-stand-alone-executable, but packages the stand-alone executable into a distribution.

(drscheme:language:create-distribution-for-executable

 

 

 

distribution-filename

 

 

 

gui?

 

 

 

make-executable)

 

  void?

  distribution-filename : (or/c path? string?)

  gui? : boolean?

  make-executable : (-> path? void?)

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 drscheme: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.

(drscheme:language:create-module-based-launcher

 

 

 

program-filename

 

 

 

executable-filename

 

 

 

module-language-spec

 

 

 

transformer-module-language-spec

 

 

 

init-code

 

 

 

gui?

 

 

 

use-copy?)

 

  void?

  program-filename : (or/c path? string?)

  executable-filename : (or/c path? string?)

  module-language-spec : any/c

  transformer-module-language-spec : any/c

  init-code : any/c

  gui? : boolean?

  use-copy? : boolean?

This procedure is identical to drscheme:language:create-module-based-stand-alone-executable, except that it creates a launcher instead of a stand-alone executable.

(drscheme:language:text/pos-text text/pos)  (is-a?/c text%)

  text/pos : drscheme:language:text/pos?

Selects the text% from a text/pos.

(drscheme:language:text/pos-start text/pos)  number?

  text/pos : drscheme:language:text/pos?

Selects the starting position from a text/pos.

(drscheme:language:text/pos-end text/pos)  number?

  text/pos : drscheme:language:text/pos?

Selects the ending position from a text/pos.

(drscheme:language:text/pos? val)  boolean?

  val : any/c

Returns #t if val is a text/pos, and #f otherwise.

(drscheme:language:make-text/pos

 

text

 

 

 

start

 

 

 

end)

 

  drscheme:language:text/pos?

  text : (is-a?/c text%)

  start : number?

  end : number?

Constructs a text/pos.

(drscheme:language:simple-settings-case-sensitive simple-settings)

  boolean?

  simple-settings : drscheme:language:simple-settings?

Extracts the case-sensitive setting from a simple-settings.

(drscheme:language:simple-settings-printing-style simple-settings)

  (symbols 'constructor 'quasiquote 'write)

  simple-settings : drscheme:language:simple-settings?

Extracts the printing-style setting from a simple-settings.

(drscheme:language:simple-settings-fraction-style simple-settings)

 

 

(symbols 'mixed-fraction

         'mixed-fraction-e

         'repeating-decimal

         'repeating-decimal-e)

  simple-settings : drscheme:language:simple-settings?

Extracts the fraction-style setting from a simple-settings.

(drscheme:language:simple-settings-show-sharing simple-settings)

  boolean?

  simple-settings : drscheme:language:simple-settings?

Extracts the show-sharing setting from a simple-settings.

(drscheme:language:simple-settings-insert-newlines simple-settings)

  boolean?

  simple-settings : drscheme:language:simple-settings?

Extracts the insert-newline setting from a simple-settings.

(drscheme:language:simple-settings-annotations simple-settings)

  (symbols 'none 'debug 'debug/profile 'test-coverage)

  simple-settings : drscheme:language:simple-settings?

Extracts the debugging setting from a simple-settings.

(drscheme:language:simple-settings? val)  boolean?

  val : any/c

Determines if val is a simple-settings.

(drscheme:language:make-simple-settings

 

case-sensitive

 

 

 

printing-style

 

 

 

fraction-style

 

 

 

show-sharing

 

 

 

insert-newlines

 

 

 

annotations)

 

  drscheme:language:simple-settings?

  case-sensitive : boolean?

  printing-style : (symbols 'constructor 'quasiquote 'write)

  fraction-style : (symbols 'mixed-fraction 'mixed-fraction-e 'repeating-decimal 'repeating-decimal-e)

  show-sharing : boolean?

  insert-newlines : boolean?

  annotations : (symbols 'none 'debug 'debug/profile 'test-coverage)

Constructs a simple settings.

(drscheme:language:simple-settings->vector simple-settings)

  vector?

  simple-settings : drscheme:language:simple-settings?

Constructs a vector whose elements are the fields of simple-settings.