pure-data/src/g_array.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 <string.h>
#include <stdio.h>      /* for read/write to files */
#include "m_pd.h"
#include "g_canvas.h"
#include <math.h>

#ifndef M_PI
#define M_PI
#endif

/* jsarlo { */
#define ARRAYPAGESIZE
/* } jsarlo */

/* --------- "pure" arrays with scalars for elements. --------------- */

/* Pure arrays have no a priori graphical capabilities.
They are instantiated by "garrays" below or can be elements of other
scalars (g_scalar.c); their graphical behavior is defined accordingly. */

t_array *array_new(t_symbol *templatesym, int length, t_gpointer *parent)
{}

/* jsarlo { */
static void garray_arrayviewlist_close(t_garray *x);
/* } jsarlo */

void array_resize(t_array *x, int n)
{}

void array_resize_and_redraw(t_array *array, t_glist *glist, int n)
{}

void word_free(t_word *wp, t_template *template);

void array_free(t_array *x)
{}

/* --------------------- graphical arrays (garrays) ------------------- */

t_class *garray_class;

struct _garray
{};

static t_pd *garray_arraytemplatecanvas;  /* written at setup w/ global lock */
static const char garray_arraytemplatefile[] =;
static const char garray_floattemplatefile[] =;

/* create invisible, built-in canvases to supply templates for floats
and float-arrays. */

void garray_init(void)
{}

/* create a new scalar attached to a symbol.  Used to make floating-point
arrays (the scalar will be of type "float-array").  Currently this is
always called by graph_array() below; but when we make a more general way
to save and create arrays this might get called more directly. */

static t_garray *graph_scalar(t_glist *gl, t_symbol *s, t_symbol *templatesym,
    int saveit, int savesize)
{}

    /* get a garray's "array" structure. */
t_array *garray_getarray(t_garray *x)
{}

    /* get the "array" structure and furthermore check it's float */
static t_array *garray_getarray_floatonly(t_garray *x,
    int *yonsetp, int *elemsizep)
{}

    /* get the array's name.  Return nonzero if it should be hidden */
int garray_getname(t_garray *x, t_symbol **namep)
{}

    /* get a garray's containing glist */
t_glist *garray_getglist(t_garray *x)
{}

    /* get a garray's associated scalar */
t_scalar *garray_getscalar(t_garray *x)
{}

        /* if there is one garray in a graph, reset the graph's coordinates
            to fit a new size and style for the garray */
static void garray_fittograph(t_garray *x, int n, int style)
{}

/* handle "array" message to glists; call graph_scalar above with
an appropriate template; then set size and flags.  This is called
from the menu and in the file format for patches.  LATER replace this
by a more coherent (and general) invocation. */

t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templateargsym,
    t_floatarg fsize, t_floatarg fflags)
{}

    /* called from array menu item to create a new one */
void canvas_menuarray(t_glist *canvas)
{}

    /* called from graph_dialog to set properties */
void garray_properties(t_garray *x)
{}

    /* this is called back from the dialog window to create a garray.
    The otherflag requests that we find an existing graph to put it in. */
void glist_arraydialog(t_glist *parent, t_symbol *name, t_floatarg size,
    t_floatarg fflags, t_floatarg otherflag)
{}

    /* this is called from the properties dialog window for an existing array */
void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize,
    t_floatarg fflags, t_floatarg deleteit)
{}

/* jsarlo { */
static void garray_arrayviewlist_fillpage(t_garray *x,
                                   t_float fPage,
                                   t_float fTopItem)
{}

static void garray_arrayviewlist_new(t_garray *x)
{}

static void garray_arrayviewlist_close(t_garray *x)
{}
/* } jsarlo */

static void garray_free(t_garray *x)
{}

/* ------------- code used by both array and plot widget functions ---- */

void array_redraw(t_array *a, t_glist *glist)
{}

    /* routine to get screen coordinates of a point in an array */
void array_getcoordinate(t_glist *glist,
    char *elem, int xonset, int yonset, int wonset, int indx,
    t_float basex, t_float basey, t_float xinc,
    t_fielddesc *xfielddesc, t_fielddesc *yfielddesc, t_fielddesc *wfielddesc,
    t_float *xp, t_float *yp, t_float *wp)
{}

static void array_getrect(t_array *array, t_glist *glist,
    int *xp1, int *yp1, int *xp2, int *yp2)
{}

/* -------------------- widget behavior for garray ------------ */

static void garray_getrect(t_gobj *z, t_glist *glist,
    int *xp1, int *yp1, int *xp2, int *yp2)
{}

static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{}

static void garray_select(t_gobj *z, t_glist *glist, int state)
{}

static void garray_activate(t_gobj *z, t_glist *glist, int state)
{}

static void garray_delete(t_gobj *z, t_glist *glist)
{}

static void garray_vis(t_gobj *z, t_glist *glist, int vis)
{}

static int garray_click(t_gobj *z, t_glist *glist,
    int xpix, int ypix, int shift, int alt, int dbl, int doit)
{}

#define ARRAYWRITECHUNKSIZE

void garray_savecontentsto(t_garray *x, t_binbuf *b)
{}

static void garray_save(t_gobj *z, t_binbuf *b)
{}

const t_widgetbehavior garray_widgetbehavior =;

/* ----------------------- public functions -------------------- */

void garray_usedindsp(t_garray *x)
{}

static void garray_doredraw(t_gobj *client, t_glist *glist)
{}

void garray_redraw(t_garray *x)
{}

   /* This functiopn gets the template of an array; if we can't figure
   out what template an array's elements belong to we're in grave trouble
   when it's time to free or resize it.  */
t_template *garray_template(t_garray *x)
{}

int garray_npoints(t_garray *x) /* get the length */
{}

char *garray_vec(t_garray *x) /* get the contents */
{}

    /* routine that checks if we're just an array of floats and if
    so returns the goods */

int garray_getfloatwords(t_garray *x, int *size, t_word **vec)
{}
    /* older, non-64-bit safe version, supplied for older externs */

int garray_getfloatarray(t_garray *x, int *size, t_float **vec)
{}

    /* set the "saveit" flag */
void garray_setsaveit(t_garray *x, int saveit)
{}

/*------------------- Pd messages ------------------------ */
static void garray_const(t_garray *x, t_floatarg g)
{}

    /* sum of Fourier components; called from routines below */
static void garray_dofo(t_garray *x, long npoints, t_float dcval,
    int nsin, t_float *vsin, int sineflag)
{}

static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{}

static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{}

static void garray_normalize(t_garray *x, t_float f)
{}

    /* list -- the first value is an index; subsequent values are put in
    the "y" slot of the array.  This generalizes Max's "table", sort of. */
static void garray_list(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{}

    /* forward a "bounds" message to the owning graph */
static void garray_bounds(t_garray *x, t_floatarg x1, t_floatarg y1,
    t_floatarg x2, t_floatarg y2)
{}

    /* same for "xticks", etc */
static void garray_xticks(t_garray *x,
    t_floatarg point, t_floatarg inc, t_floatarg f)
{}

static void garray_yticks(t_garray *x,
    t_floatarg point, t_floatarg inc, t_floatarg f)
{}

static void garray_xlabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{}

static void garray_ylabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
{}

static void garray_style(t_garray *x, t_floatarg fstyle)
{}

static void garray_width(t_garray *x, t_floatarg width)
{}

static void garray_color(t_garray *x, t_floatarg color)
{}

static void garray_vis_msg(t_garray *x, t_floatarg fvis)
{}

    /* change the name of a garray. */
static void garray_rename(t_garray *x, t_symbol *s)
{}

static void garray_read(t_garray *x, t_symbol *filename)
{}

static void garray_write(t_garray *x, t_symbol *filename)
{}

void garray_resize_long(t_garray *x, long n)
{}

    /* float version to use as Pd method */
static void garray_doresize(t_garray *x, t_floatarg f)
{}
    /* deprecated function, kept only for ABI compatibility */
void garray_resize(t_garray *x, t_floatarg f)
{}

/* ignore zoom for now */
static void garray_zoom(t_garray *x, t_floatarg f)
{}

static void garray_edit(t_garray *x, t_floatarg f)
{}

static void garray_print(t_garray *x)
{}

void g_array_setup(void)
{}