pure-data/src/m_binbuf.c

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


#include <stdlib.h>
#include "m_pd.h"
#include "s_stuff.h"
#include "g_canvas.h"
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _WIN32
#include <io.h>
#endif
#include <string.h>
#include <stdarg.h>

#include "m_private_utils.h"

struct _binbuf
{};

t_binbuf *binbuf_new(void)
{}

void binbuf_free(t_binbuf *x)
{}

t_binbuf *binbuf_duplicate(const t_binbuf *y)
{}

void binbuf_clear(t_binbuf *x)
{}

    /* convert text to a binbuf */
void binbuf_text(t_binbuf *x, const char *text, size_t size)
{}

    /* convert a binbuf to text; no null termination. */
void binbuf_gettext(const t_binbuf *x, char **bufp, int *lengthp)
{}

/* LATER improve the out-of-space behavior below.  Also fix this so that
writing to file doesn't buffer everything together. */

void binbuf_add(t_binbuf *x, int argc, const t_atom *argv)
{}

#define MAXADDMESSV
void binbuf_addv(t_binbuf *x, const char *fmt, ...)
{}

/* add a binbuf to another one for saving.  Semicolons and commas go to
symbols ";", "'",; and inside symbols, characters ';', ',' and '$' get
escaped.  LATER also figure out about escaping white space */

void binbuf_addbinbuf(t_binbuf *x, const t_binbuf *y)
{}

void binbuf_addsemi(t_binbuf *x)
{}

/* Supply atoms to a binbuf from a message, making the opposite changes
from binbuf_addbinbuf.  The symbol ";" goes to a semicolon, etc. */

void binbuf_restore(t_binbuf *x, int argc, const t_atom *argv)
{}

void binbuf_print(const t_binbuf *x)
{}

int binbuf_getnatom(const t_binbuf *x)
{}

t_atom *binbuf_getvec(const t_binbuf *x)
{}

int binbuf_resize(t_binbuf *x, int newsize)
{}

int canvas_getdollarzero(void);

/* JMZ:
 * s points to the first character after the $
 * (e.g. if the org.symbol is "$1-bla", then s will point to "1-bla")
 * (e.g. org.symbol="hu-$1mu", s="1mu")
 * LATER: think about more complex $args, like ${$1+3}
 *
 * the return value holds the length of the $arg (in most cases: 1)
 * buf holds the expanded $arg
 *
 * if some error occurred, "-1" is returned
 *
 * e.g. "$1-bla" with list "10 20 30"
 * s="1-bla"
 * buf="10"
 * return value = 1; (s+1=="-bla")
 */
static int binbuf_expanddollsym(const char *s, char *buf, t_atom *dollar0,
    int ac, const t_atom *av, int tonew)
{}

/* expand any '$' variables in the symbol s.  "tonow" is set if this is in the
context of a message to create a new object; in this case out-of-range '$'
args become 0 - otherwise zero is returned and the caller has to check the
result. */
/* LATER remove the dependence on the current canvas for $0; should be another
argument. */
t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, const t_atom *av,
    int tonew)
{}

#define SMALLMSG
#define HUGEMSG

void binbuf_eval(const t_binbuf *x, t_pd *target, int argc, const t_atom *argv)
{}

int binbuf_read(t_binbuf *b, const char *filename, const char *dirname, int crflag)
{}

    /* read a binbuf from a file, via the search patch of a canvas */
int binbuf_read_via_canvas(t_binbuf *b, const char *filename,
    const t_canvas *canvas, int crflag)
{}

    /* old version */
int binbuf_read_via_path(t_binbuf *b, const char *filename, const char *dirname,
    int crflag)
{}

#define WBUFSIZE
static t_binbuf *binbuf_convert(const t_binbuf *oldb, int maxtopd);

    /* write a binbuf to a text file.  If "crflag" is set we suppress
    semicolons. */
int binbuf_write(const t_binbuf *x, const char *filename, const char *dir, int crflag)
{}

/* The following routine attempts to convert from max to pd or back.  The
max to pd direction is working OK but you will need to make lots of
abstractions for objects like "gate" which don't exist in Pd.  conversion
from Pd to Max hasn't been tested for patches with subpatches yet!  */

#define MAXSTACK

#define ISSYMBOL(a, b)

static t_binbuf *binbuf_convert(const t_binbuf *oldb, int maxtopd)
{}

/* LATER make this evaluate the file on-the-fly. */
/* LATER figure out how to log errors */
void binbuf_evalfile(t_symbol *name, t_symbol *dir)
{}

    /* save a text object to a binbuf for a file or copy buf */
void binbuf_savetext(const t_binbuf *bfrom, t_binbuf *bto)
{}