diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
commit | 0d4560cb0305029fa5f0739670286176ab47cb65 (patch) | |
tree | 9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/g_traversal.c | |
parent | eabeb928ddfdbe5fc6379efb87d9522803310649 (diff) | |
download | rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip |
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_traversal.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_traversal.c | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_traversal.c b/apps/plugins/pdbox/PDa/src/g_traversal.c index 0e2c6855b4..b6ac2d110e 100644 --- a/apps/plugins/pdbox/PDa/src/g_traversal.c +++ b/apps/plugins/pdbox/PDa/src/g_traversal.c | |||
@@ -16,11 +16,18 @@ sublist - get a pointer into a list which is an element of another scalar | |||
16 | 16 | ||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifdef ROCKBOX | ||
20 | #include "plugin.h" | ||
21 | #include "pdbox.h" | ||
22 | #include "m_pd.h" | ||
23 | #include "g_canvas.h" | ||
24 | #else /* ROCKBOX */ | ||
19 | #include <stdlib.h> | 25 | #include <stdlib.h> |
20 | #include <string.h> | 26 | #include <string.h> |
21 | #include <stdio.h> /* for read/write to files */ | 27 | #include <stdio.h> /* for read/write to files */ |
22 | #include "m_pd.h" | 28 | #include "m_pd.h" |
23 | #include "g_canvas.h" | 29 | #include "g_canvas.h" |
30 | #endif /* ROCKBOX */ | ||
24 | 31 | ||
25 | /* ------------- gstubs and gpointers - safe pointing --------------- */ | 32 | /* ------------- gstubs and gpointers - safe pointing --------------- */ |
26 | 33 | ||
@@ -135,7 +142,7 @@ void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto) | |||
135 | void gpointer_unset(t_gpointer *gp) | 142 | void gpointer_unset(t_gpointer *gp) |
136 | { | 143 | { |
137 | t_gstub *gs; | 144 | t_gstub *gs; |
138 | if (gs = gp->gp_stub) | 145 | if((gs = gp->gp_stub)) |
139 | { | 146 | { |
140 | gstub_dis(gs); | 147 | gstub_dis(gs); |
141 | gp->gp_stub = 0; | 148 | gp->gp_stub = 0; |
@@ -145,7 +152,7 @@ void gpointer_unset(t_gpointer *gp) | |||
145 | void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x) | 152 | void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x) |
146 | { | 153 | { |
147 | t_gstub *gs; | 154 | t_gstub *gs; |
148 | if (gs = gp->gp_stub) gstub_dis(gs); | 155 | if((gs = gp->gp_stub)) gstub_dis(gs); |
149 | gp->gp_stub = gs = glist->gl_stub; | 156 | gp->gp_stub = gs = glist->gl_stub; |
150 | gp->gp_valid = glist->gl_valid; | 157 | gp->gp_valid = glist->gl_valid; |
151 | gp->gp_un.gp_scalar = x; | 158 | gp->gp_un.gp_scalar = x; |
@@ -155,7 +162,7 @@ void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x) | |||
155 | static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w) | 162 | static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w) |
156 | { | 163 | { |
157 | t_gstub *gs; | 164 | t_gstub *gs; |
158 | if (gs = gp->gp_stub) gstub_dis(gs); | 165 | if((gs = gp->gp_stub)) gstub_dis(gs); |
159 | gp->gp_stub = gs = array->a_stub; | 166 | gp->gp_stub = gs = array->a_stub; |
160 | gp->gp_valid = array->a_valid; | 167 | gp->gp_valid = array->a_valid; |
161 | gp->gp_un.gp_w = w; | 168 | gp->gp_un.gp_w = w; |
@@ -194,6 +201,9 @@ static void *ptrobj_new(t_symbol *classname, int argc, t_atom *argv) | |||
194 | t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class); | 201 | t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class); |
195 | t_typedout *to; | 202 | t_typedout *to; |
196 | int n; | 203 | int n; |
204 | #ifdef ROCKBOX | ||
205 | (void) classname; | ||
206 | #endif | ||
197 | gpointer_init(&x->x_gp); | 207 | gpointer_init(&x->x_gp); |
198 | x->x_typedout = to = (t_typedout *)getbytes(argc * sizeof (*to)); | 208 | x->x_typedout = to = (t_typedout *)getbytes(argc * sizeof (*to)); |
199 | x->x_ntypedout = n = argc; | 209 | x->x_ntypedout = n = argc; |
@@ -285,10 +295,14 @@ static void ptrobj_next(t_ptrobj *x) | |||
285 | 295 | ||
286 | static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) | 296 | static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) |
287 | { | 297 | { |
298 | #ifdef ROCKBOX | ||
299 | (void) s; | ||
300 | #else /* ROCKBOX */ | ||
288 | t_scalar *sc; | 301 | t_scalar *sc; |
289 | t_symbol *templatesym; | 302 | t_symbol *templatesym; |
290 | int n; | 303 | int n; |
291 | t_typedout *to; | 304 | t_typedout *to; |
305 | #endif /* ROCKBOX */ | ||
292 | t_glist *glist; | 306 | t_glist *glist; |
293 | t_pd *canvas; | 307 | t_pd *canvas; |
294 | t_gstub *gs; | 308 | t_gstub *gs; |
@@ -388,6 +402,9 @@ static void *get_new(t_symbol *why, int argc, t_atom *argv) | |||
388 | int i; | 402 | int i; |
389 | t_getvariable *sp; | 403 | t_getvariable *sp; |
390 | x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); | 404 | x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); |
405 | #ifdef ROCKBOX | ||
406 | (void) why; | ||
407 | #endif | ||
391 | if (argc) argc--, argv++; | 408 | if (argc) argc--, argv++; |
392 | x->x_variables | 409 | x->x_variables |
393 | = (t_getvariable *)getbytes(argc * sizeof (*x->x_variables)); | 410 | = (t_getvariable *)getbytes(argc * sizeof (*x->x_variables)); |
@@ -468,6 +485,9 @@ static void *set_new(t_symbol *why, int argc, t_atom *argv) | |||
468 | int i; | 485 | int i; |
469 | t_setvariable *sp; | 486 | t_setvariable *sp; |
470 | x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); | 487 | x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); |
488 | #ifdef ROCKBOX | ||
489 | (void) why; | ||
490 | #endif | ||
471 | if (argc) argc--, argv++; | 491 | if (argc) argc--, argv++; |
472 | x->x_variables | 492 | x->x_variables |
473 | = (t_setvariable *)getbytes(argc * sizeof (*x->x_variables)); | 493 | = (t_setvariable *)getbytes(argc * sizeof (*x->x_variables)); |
@@ -634,6 +654,9 @@ static void elem_float(t_elem *x, t_float f) | |||
634 | 654 | ||
635 | static void elem_free(t_elem *x, t_gpointer *gp) | 655 | static void elem_free(t_elem *x, t_gpointer *gp) |
636 | { | 656 | { |
657 | #ifdef ROCKBOX | ||
658 | (void) gp; | ||
659 | #endif | ||
637 | gpointer_unset(&x->x_gp); | 660 | gpointer_unset(&x->x_gp); |
638 | gpointer_unset(&x->x_gparent); | 661 | gpointer_unset(&x->x_gparent); |
639 | } | 662 | } |
@@ -667,13 +690,19 @@ static void *getsize_new(t_symbol *templatesym, t_symbol *fieldsym) | |||
667 | 690 | ||
668 | static void getsize_pointer(t_getsize *x, t_gpointer *gp) | 691 | static void getsize_pointer(t_getsize *x, t_gpointer *gp) |
669 | { | 692 | { |
693 | #ifdef ROCKBOX | ||
694 | int onset, type; | ||
695 | #else /* ROCKBOX */ | ||
670 | int nitems, onset, type; | 696 | int nitems, onset, type; |
697 | #endif /* ROCKBOX */ | ||
671 | t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym, | 698 | t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym, |
672 | *elemtemplatesym; | 699 | *elemtemplatesym; |
673 | t_template *template = template_findbyname(templatesym); | 700 | t_template *template = template_findbyname(templatesym); |
674 | t_word *w; | 701 | t_word *w; |
675 | t_array *array; | 702 | t_array *array; |
703 | #ifndef ROCKBOX | ||
676 | int elemsize; | 704 | int elemsize; |
705 | #endif | ||
677 | t_gstub *gs = gp->gp_stub; | 706 | t_gstub *gs = gp->gp_stub; |
678 | if (!template) | 707 | if (!template) |
679 | { | 708 | { |
@@ -731,6 +760,9 @@ typedef struct _setsize | |||
731 | static void *setsize_new(t_symbol *templatesym, t_symbol *fieldsym, | 760 | static void *setsize_new(t_symbol *templatesym, t_symbol *fieldsym, |
732 | t_floatarg newsize) | 761 | t_floatarg newsize) |
733 | { | 762 | { |
763 | #ifdef ROCKBOX | ||
764 | (void) newsize; | ||
765 | #endif | ||
734 | t_setsize *x = (t_setsize *)pd_new(setsize_class); | 766 | t_setsize *x = (t_setsize *)pd_new(setsize_class); |
735 | x->x_templatesym = canvas_makebindsym(templatesym); | 767 | x->x_templatesym = canvas_makebindsym(templatesym); |
736 | x->x_fieldsym = fieldsym; | 768 | x->x_fieldsym = fieldsym; |
@@ -748,7 +780,9 @@ static void setsize_float(t_setsize *x, t_float f) | |||
748 | t_template *template = template_findbyname(templatesym); | 780 | t_template *template = template_findbyname(templatesym); |
749 | t_template *elemtemplate; | 781 | t_template *elemtemplate; |
750 | t_word *w; | 782 | t_word *w; |
783 | #ifndef ROCKBOX | ||
751 | t_atom at; | 784 | t_atom at; |
785 | #endif | ||
752 | t_array *array; | 786 | t_array *array; |
753 | int elemsize; | 787 | int elemsize; |
754 | int newsize = f; | 788 | int newsize = f; |
@@ -830,7 +864,11 @@ static void setsize_float(t_setsize *x, t_float f) | |||
830 | if (newsize > nitems) | 864 | if (newsize > nitems) |
831 | { | 865 | { |
832 | char *newelem = ((char *)array->a_vec) + nitems * elemsize; | 866 | char *newelem = ((char *)array->a_vec) + nitems * elemsize; |
867 | #ifdef ROCKBOX | ||
868 | int nnew = newsize - nitems; | ||
869 | #else /* ROCKBOX */ | ||
833 | int i = 0, nnew = newsize - nitems; | 870 | int i = 0, nnew = newsize - nitems; |
871 | #endif /* ROCKBOX */ | ||
834 | 872 | ||
835 | while (nnew--) | 873 | while (nnew--) |
836 | { | 874 | { |
@@ -896,6 +934,9 @@ static void *append_new(t_symbol *why, int argc, t_atom *argv) | |||
896 | int i; | 934 | int i; |
897 | t_appendvariable *sp; | 935 | t_appendvariable *sp; |
898 | x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); | 936 | x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); |
937 | #ifdef ROCKBOX | ||
938 | (void) why; | ||
939 | #endif | ||
899 | if (argc) argc--, argv++; | 940 | if (argc) argc--, argv++; |
900 | x->x_variables | 941 | x->x_variables |
901 | = (t_appendvariable *)getbytes(argc * sizeof (*x->x_variables)); | 942 | = (t_appendvariable *)getbytes(argc * sizeof (*x->x_variables)); |
@@ -1023,8 +1064,10 @@ static void sublist_pointer(t_sublist *x, t_gpointer *gp) | |||
1023 | t_symbol *templatesym = x->x_templatesym, *dummy; | 1064 | t_symbol *templatesym = x->x_templatesym, *dummy; |
1024 | t_template *template = template_findbyname(templatesym); | 1065 | t_template *template = template_findbyname(templatesym); |
1025 | t_gstub *gs = gp->gp_stub; | 1066 | t_gstub *gs = gp->gp_stub; |
1026 | t_word *vec; | 1067 | #ifndef ROCKBOX |
1068 | t_word *vec; | ||
1027 | t_getvariable *vp; | 1069 | t_getvariable *vp; |
1070 | #endif | ||
1028 | int onset, type; | 1071 | int onset, type; |
1029 | t_word *w; | 1072 | t_word *w; |
1030 | 1073 | ||
@@ -1059,6 +1102,9 @@ static void sublist_pointer(t_sublist *x, t_gpointer *gp) | |||
1059 | 1102 | ||
1060 | static void sublist_free(t_sublist *x, t_gpointer *gp) | 1103 | static void sublist_free(t_sublist *x, t_gpointer *gp) |
1061 | { | 1104 | { |
1105 | #ifdef ROCKBOX | ||
1106 | (void) gp; | ||
1107 | #endif | ||
1062 | gpointer_unset(&x->x_gp); | 1108 | gpointer_unset(&x->x_gp); |
1063 | } | 1109 | } |
1064 | 1110 | ||