diff --git a/examples/gemini/gemini.fs b/examples/gemini/gemini.fs index a123f9b..8e9ffb8 100644 --- a/examples/gemini/gemini.fs +++ b/examples/gemini/gemini.fs @@ -36,6 +36,8 @@ r| What's the "time"?| askit >json a. cr cr r| What's the "time"?| askit _s" contents" dict@ 0 a@ _s" parts" dict@ 0 a@ _s" text" dict@ >json a. cr 0 [IF] +_s" sample.txt" slurp json> _s" candidates" dict@ 0 a@ _s" content" dict@ _s" parts" dict@ 0 a@ _s" text" dict@ a. + HTTPClient NetworkClientSecure.new constant nclient diff --git a/examples/gemini/slurp.fs b/examples/gemini/slurp.fs index 5e23da3..0a1db35 100644 --- a/examples/gemini/slurp.fs +++ b/examples/gemini/slurp.fs @@ -12,11 +12,16 @@ \ See the License for the specific language governing permissions and \ limitations under the License. -: slurp-file ( a n -- a n ) - r/o open-file throw >r +needs arrays.fs + +also arrays + +: slurp ( a: filename -- a: content ) + top range r/o open-file throw >r adrop r@ file-size throw ( sz ) - dup 1+ allocate throw swap ( data sz ) - 2dup r@ read-file throw drop + STRING array + top range r@ read-file throw drop r> close-file throw - 2dup + 0 swap c! ; + +previous