pure-data/src/g_scalar.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.  */

/* This file defines the "scalar" object, which is not a text object, just a
"gobj".  Scalars have templates which describe their structures, which
can contain numbers, sublists, and arrays.

*/

#include <stdio.h>      /* for read/write to files */
#include <string.h>
#include "m_pd.h"
#include "g_canvas.h"

/* ------------- gstubs and gpointers - safe pointing --------------- */

/* create a gstub which is "owned" by a glist (gl) or an array ("a"). */

t_gstub *gstub_new(t_glist *gl, t_array *a)
{}

/* when a "gpointer" is set to point to this stub (so we can later chase
down the owner) we increase a reference count.  The following routine is called
whenever a gpointer is unset from pointing here.  If the owner is
gone and the refcount goes to zero, we can free the gstub safely. */

static void gstub_dis(t_gstub *gs)
{}

/* this routing is called by the owner to inform the gstub that it is
being deleted.  If no gpointers are pointing here, we can free the gstub;
otherwise we wait for the last gstub_dis() to free it. */

void gstub_cutoff(t_gstub *gs)
{}

/* call this to verify that a pointer is fresh, i.e., that it either
points to real data or to the head of a list, and that in either case
the object hasn't disappeared since this pointer was generated.
Unless "headok" is set,  the routine also fails for the head of a list. */

int gpointer_check(const t_gpointer *gp, int headok)
{}

    /* copy a pointer to another, assuming the second one hasn't yet been
    initialized.  New gpointers should be initialized either by this
    routine or by gpointer_init below. */
void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto)
{}

    /* clear a gpointer that was previously set, releasing the associated
    gstub if this was the last reference to it. */
void gpointer_unset(t_gpointer *gp)
{}

void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x)
{}

void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w)
{}

void gpointer_init(t_gpointer *gp)
{}

/*********  random utility function to find a binbuf in a datum */

/* get the template for the object pointer to.  Assumes we've already checked
freshness. */

t_symbol *gpointer_gettemplatesym(const t_gpointer *gp)
{}

t_binbuf *pointertobinbuf(t_pd *x, t_gpointer *gp, t_symbol *s,
    const char *fname)
{}

void word_init(t_word *wp, t_template *template, t_gpointer *gp)
{}

    /* a block versions of word_init is provided because
    creating and destroying large arrays had been absurdly slowing down patch
    loading and closing.  The first one is created as above and the rest
    are simply copied from the first one, in a way that now appears
    unnecessarily convoluted. */
void word_initvec(t_word *wp, t_template *template, t_gpointer *gp, long n)
{}

void word_restore(t_word *wp, t_template *template,
    int argc, t_atom *argv)
{}

void word_free(t_word *wp, t_template *template)
{}

void word_freevec(t_word *wp, t_template *template, long n)
{}

static int template_cancreate(t_template *template)
{}

/* ------------------- scalars ---------------------- */

t_class *scalar_class;
    /* make a new scalar and add to the glist.  We create a "gp" here which
    will be used for array items to point back here.  This gp doesn't do
    reference counting or "validation" updates though; the parent won't go away
    without the contained arrays going away too.  The "gp" is copied out
    by value in the word_init() routine so we can throw our copy away. */

t_scalar *scalar_new(t_glist *owner, t_symbol *templatesym)
{}

    /* Pd method to create a new scalar, add it to a glist, and initialize
    it from the message arguments. */

void glist_scalar(t_glist *glist,
    t_symbol *classname, int argc, t_atom *argv)
{}

extern t_class *drawnumber_class;


/* -------------------- widget behavior for scalar ------------ */
void scalar_getbasexy(t_scalar *x, t_float *basex, t_float *basey)
{}

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

static void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state)
{}

static void scalar_select(t_gobj *z, t_glist *owner, int state)
{}

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

static void scalar_activate(t_gobj *z, t_glist *owner, int state)
{}

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

static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
{}

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

void scalar_redraw(t_scalar *x, t_glist *glist)
{}

extern void template_notifyforscalar(t_template *template, t_glist *owner,
    t_scalar *sc, t_symbol *s, int argc, t_atom *argv);

int scalar_doclick(t_word *data, t_template *template, t_scalar *sc,
    t_array *ap, struct _glist *owner,
    t_float xloc, t_float yloc, int xpix, int ypix,
    int shift, int alt, int dbl, int doit)
{}

int scalar_click(t_gobj *z, struct _glist *owner,
    int xpix, int ypix, int shift, int alt, int dbl, int doit)
{}

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

static void scalar_properties(t_gobj *z, struct _glist *owner)
{}

static const t_widgetbehavior scalar_widgetbehavior =;

static void scalar_free(t_scalar *x)
{}

/* ----------------- setup function ------------------- */

void g_scalar_setup(void)
{}