Further small changes on the way to a reader.

This commit is contained in:
Simon Brooke 2026-04-01 08:50:35 +01:00
parent a302663b32
commit cc8e96eda4
4 changed files with 60 additions and 3 deletions

View file

@ -69,4 +69,17 @@ struct pso_pointer read_example( struct pso4 *frame,
}
// struct pso_pointer read
/**
* Read the next object on this input stream and return a pso_pointer to it.
*/
struct pso_pointer read( struct pso4 *frame,
struct pso_pointer frame_pointer,
struct pso_pointer env ) {
struct pso_pointer* character = fetch_arg( frame, 0);
struct pso_pointer stream = fetch_arg( frame, 1);
struct pso_pointer readtable = fetch_arg( frame, 2);
if (nilp(stream)) {
}
}

View file

@ -0,0 +1,33 @@
/**
* payloads/read_stream.h
*
* A read stream.
*
* (c) 2026 Simon Brooke <simon@journeyman.cc>
* Licensed under GPL version 2.0, or, at your option, any later version.
*/
#include <stdio.h>
#include <curl/curl.h>
#include "io/fopen.h"
#include "memory/pointer.h"
/**
* Construct a cell which points to a stream open for reading.
* @param input the C stream to wrap.
* @param metadata a pointer to an associaton containing metadata on the stream.
* @return a pointer to the new read stream.
*/
struct pso_pointer make_read_stream( URL_FILE *input,
struct pso_pointer metadata ) {
struct pso_pointer pointer = allocate( READTV, 2);
struct pso2 *cell = pointer_to_object( pointer );
cell->payload.stream.stream = input;
cell->payload.stream.meta = metadata;
return pointer;
}