Changeset 15 for vis_dev/glu-2.3


Ignore:
Timestamp:
Jul 13, 2011, 11:05:09 AM (13 years ago)
Author:
cecile
Message:

Vis main file for expermeriments

Location:
vis_dev/glu-2.3/src/array
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vis_dev/glu-2.3/src/array/array.c

    r13 r15  
    6565    }
    6666    (void) memcpy(newa->space, old->space, old->num * old->obj_size);
     67    return newa;
     68}
     69
     70array_t *
     71array_partial_dup(array_t *old, int i)
     72{
     73    array_t *newa;
     74
     75    newa = ALLOC(array_t, 1);
     76    if (newa == NIL(array_t)) {
     77        return NIL(array_t);
     78    }
     79    newa->num = old->num - 1;
     80    newa->n_size = old->num - 1;
     81    newa->obj_size = old->obj_size;
     82    newa->index = -newa->obj_size;
     83    newa->space = ALLOC(char, newa->n_size * newa->obj_size);
     84    if (newa->space == NIL(char)) {
     85        FREE(newa);
     86        return NIL(array_t);
     87    }
     88    if (i > 0)
     89      (void) memcpy(newa->space, old->space, i * old->obj_size);
     90    if (i < old->num - 1)
     91      (void) memcpy(newa->space + ((i) * old->obj_size),
     92                    old->space + ((i+1) * old->obj_size), (old->num - (i + 1)) * old->obj_size);
    6793    return newa;
    6894}
  • vis_dev/glu-2.3/src/array/array.h

    r13 r15  
    3434EXTERN int array_resize ARGS((array_t *, int));
    3535EXTERN char *array_do_data ARGS((array_t *));
     36EXTERN array_t * array_partial_dup(array_t *old, int i);
    3637
    3738extern int unsigned array_global_index;
Note: See TracChangeset for help on using the changeset viewer.