Skip to content

Commit

Permalink
#1657: SLIME jrunscript Resource documentation JSAPI -> Fifty
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpcaldwell committed Sep 12, 2024
1 parent 327db35 commit 4527d83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 83 deletions.
78 changes: 0 additions & 78 deletions loader/jrunscript/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,84 +22,6 @@ <h1>Properties</h1>
</p>
<div class="label">has properties:</div>
<ul>
<li class="constructor" jsapi:id="Resource">
<div class="name"><a id="$exports.Resource">Resource</a></div>
<div class="instances">
<div class="label">Instances</div>
<span class="type">supports SLIME <a href="../api.html#types.Loader.resource">resource</a></span>
<div class="label">has properties:</div>
<ul>
<li class="function">
<div class="name">read</div>
<div class="arguments">
<div class="label">Arguments</div>
<ol>
<li class="value">
<span class="type">Standard read() type OR Packages.java.util.Properties OR Streams.binary OR Streams.text</span>
<span>A constant value indicating the type desired.</span>
</li>
</ol>
</div>
<div class="returns">
<div class="label">Returns</div>
A standard <code>read()</code> type, or:
<span class="type">Packages.java.util.Properties</span>,
<span class="type"><a href="#types.binput">byte input stream</a></span>,
<span class="type"><a href="#types.binput">character input stream</a></span>
<span>Depending on the type argument given, returns the content of the resource in the given format.</span>
</div>
<div class="label">has properties:</div>
</li>
<li class="value">
<div class="name">length</div>
<span class="type">number</span>
<span>
(conditional)
The length of this resource, in bytes.
</span>
</li>
<li class="function">
<div class="name">write</div>
<span>
(optional: if resource is writable)
Writes content to this resource, or returns a stream to which content can be written to write content to
this resource.
</span>
<div class="arguments">
<div class="label">Arguments</div>
<ol>
<li class="value">
<span class="type">Streams.binary or Streams.text</span>,
<span class="type">string</span>,
or <span class="type">xml</span>
<span>
If the given value is a <code>string</code> or <code>xml</code>, writes the given value
to the resource. If the given value is <code>Streams.binary</code> or
<code>Streams.text</code>, opens a stream of the appropriate type for writing to the given
resource.
</span>
</li>
<li class="value">
<span class="type">object</span>
<span><a name="Resource.write.arguments[1]">
An argument that can be used to configure the write operation; its semantics depend on
the underlying implementation.
</a></span>
</li>
</ol>
</div>
<div class="returns">
<div class="label">Returns</div>
<span class="type">(varies)</span>
<span>
If <code>arguments[0]</code> specifies a stream to open, returns that stream; otherwise, returns
<code>undefined</code>.
</span>
</div>
</li>
</ul>
</div>
</li>
<li jsapi:id="Loader" class="constructor">
<div jsapi:id="type" class="type">
<a class="type" name="types.Loader">Loader</a>
Expand Down
19 changes: 14 additions & 5 deletions loader/jrunscript/expression.fifty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ namespace slime.jrunscript.runtime {
export interface Resource<JA = (path: string) => slime.jrunscript.native.inonit.script.engine.Code.Loader.Resource> extends slime.Resource {
/**
* Provides the content of this resource, or a stream from which to read it. Extends the standard `read()`
* implementation from the SLIME runtime Resource.
* implementation from the SLIME runtime Resource with Java-specific types and the ability to obtain Java streams from
* the resource.
*/
read: slime.Resource["read"] & {
// TODO Java-specific
Expand Down Expand Up @@ -115,10 +116,16 @@ namespace slime.jrunscript.runtime {
modified?: any

/**
* If the first argument is is `Streams.binary` or `Streams.text`, this method opens a stream and returns it. If the argument is a
* string, this method opens a character stream, writes the string to the stream, and closes the stream. If the value is
* a binary or character input stream, this method reads the stream until it is exhausted and copies its contents to the
* location of this file, closing the stream after doing so.
* (optional: if resource is writable) Writes content to this resource, or returns a stream to which content can be
* written to write content to this resource.
*
* If the first argument is is `Streams.binary` or `Streams.text`, this method opens a stream and returns it. If the
* argument is a string, this method opens a character stream, writes the string to the stream, and closes the stream.
* If the value is a {@link slime.jrunscript.native.java.util.Properties}, this method opens a character stream, writes
* the properties to the resource, and closes the stream. If the value is an {@link slime.external.e4x.XML} or {@link
* slime.external.e4x.XMLList}, the value is serialized as XML and written to the resource, If the value is a binary or
* character input stream, this method reads the stream until it is exhausted and copies its contents to the resource,
* closing the stream after doing so.
*
* @returns See the description of the method; the return type depends on the arguments. May return a binary output
* stream, a character output stream, or `undefined`.
Expand All @@ -130,6 +137,8 @@ namespace slime.jrunscript.runtime {
(input: slime.jrunscript.runtime.io.Reader, mode?: resource.WriteMode): void
(input: string, mode?: resource.WriteMode): void
(input: slime.jrunscript.native.java.util.Properties, mode?: resource.WriteMode): void
(input: slime.external.e4x.XML, mode?: resource.WriteMode): void
(input: slime.external.e4x.XMLList, mode?: resource.WriteMode): void
}

java?: {
Expand Down

0 comments on commit 4527d83

Please sign in to comment.