pure-data/src/g_readwrite.c

/* Copyright (c) 1997-2002 Miller Puckette and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */

/*
Routines to read and write canvases to files:
canvas_savetofile() writes a root canvas to a "pd" file.  (Reading "pd" files
is done simply by passing the contents to the pd message interpreter.)
Alternatively, the  glist_read() and glist_write() routines read and write
"data" from and to files (reading reads into an existing canvas), using a
file format as in the dialog window for data.
*/

#include "m_pd.h"
#include "g_canvas.h"
#include <string.h>
#include <errno.h>

/* object to assist in saving state by abstractions */
static t_class *savestate_class;

t_savestate;

static void *savestate_new(void)
{}

    /* call this when the owning abstraction's parent patch is saved so we
    can add state-restoring messages to binbuf */
static void savestate_doit(t_savestate *x, t_binbuf *b)
{}

    /* called by abstraction in response to savestate_doit(); lists received
    here are added to the parent patch's save buffer after the line that will
    create the abstraction, addressed to "#A" which will be this patch after
    it is recreated by reopening the parent patch, pasting, or "undo". */
static void savestate_list(t_savestate *x, t_symbol *s, int argc, t_atom *argv)
{}

static void savestate_setup(void)
{}

void canvas_statesavers_doit(t_glist *x, t_binbuf *b)
{}

void canvas_saved(t_glist *x, t_symbol *s, int argc, t_atom *argv)
{}

static t_class *declare_class;
void canvas_savedeclarationsto(t_canvas *x, t_binbuf *b);

    /* the following routines read "scalars" from a file into a canvas. */

static int canvas_scanbinbuf(int natoms, t_atom *vec, int *p_indexout,
    int *p_next)
{}

int canvas_readscalar(t_glist *x, int natoms, t_atom *vec,
    int *p_nextmsg, int selectit);

static void canvas_readerror(int natoms, t_atom *vec, int message,
    int nline, char *s)
{}

    /* fill in the contents of the scalar into the vector w. */

static void glist_readatoms(t_glist *x, int natoms, t_atom *vec,
    int *p_nextmsg, t_symbol *templatesym, t_word *w, int argc, t_atom *argv)
{}

int canvas_readscalar(t_glist *x, int natoms, t_atom *vec,
    int *p_nextmsg, int selectit)
{}

void glist_readfrombinbuf(t_glist *x, const t_binbuf *b, const char *filename, int selectem)
{}

static void glist_doread(t_glist *x, t_symbol *filename, t_symbol *format,
    int clearme)
{}

void glist_read(t_glist *x, t_symbol *filename, t_symbol *format)
{}

void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format)
{}

    /* read text from a "properties" window, called from a gfxstub set
    up in scalar_properties().  We try to restore the object; if successful
    we either copy the data from the new scalar to the old one in place
    (if their templates match) or else delete the old scalar and put the new
    thing in its place on the list. */
void canvas_dataproperties(t_canvas *x, t_scalar *sc, t_binbuf *b)
{}

    /* ----------- routines to write data to a binbuf ----------- */

void canvas_doaddtemplate(t_symbol *templatesym,
    int *p_ntemplates, t_symbol ***p_templatevec)
{}

static void glist_writelist(t_gobj *y, t_binbuf *b);

void binbuf_savetext(t_binbuf *bfrom, t_binbuf *bto);

void canvas_writescalar(t_symbol *templatesym, t_word *w, t_binbuf *b,
    int amarrayelement)
{}

static void glist_writelist(t_gobj *y, t_binbuf *b)
{}

    /* ------------ routines to write out templates for data ------- */

static void canvas_addtemplatesforlist(t_gobj *y,
    int  *p_ntemplates, t_symbol ***p_templatevec);

static void canvas_addtemplatesforscalar(t_symbol *templatesym,
    t_word *w, int *p_ntemplates, t_symbol ***p_templatevec)
{}

static void canvas_addtemplatesforlist(t_gobj *y,
    int  *p_ntemplates, t_symbol ***p_templatevec)
{}

    /* write all "scalars" in a glist to a binbuf. */
t_binbuf *glist_writetobinbuf(t_glist *x, int wholething)
{}

static void glist_write(t_glist *x, t_symbol *filename, t_symbol *format)
{}

/* ------ routines to save and restore canvases (patches) recursively. ----*/

t_zoomfn;

    /* save to a binbuf, called recursively; cf. canvas_savetofile() which
    saves the document, and is only called on root canvases. */
static void canvas_saveto(t_canvas *x, t_binbuf *b)
{}

    /* call this recursively to collect all the template names for
    a canvas or for the selection. */
static void canvas_collecttemplatesfor(t_canvas *x, int *ntemplatesp,
    t_symbol ***templatevecp, int wholething)
{}

    /* save the templates needed by a canvas to a binbuf. */
static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething)
{}

void canvas_reload(t_symbol *name, t_symbol *dir, t_glist *except);

    /* save a "root" canvas to a file; cf. canvas_saveto() which saves the
    body (and which is called recursively.) */
static void canvas_savetofile(t_canvas *x, t_symbol *filename, t_symbol *dir,
    float fdestroy)
{}

static void canvas_menusaveas(t_canvas *x, t_float fdestroy)
{}

static void canvas_menusave(t_canvas *x, t_float fdestroy)
{}

void g_readwrite_setup(void)
{}

void canvas_readwrite_for_class(t_class *c)
{}