-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdutils.c
50 lines (45 loc) · 1.08 KB
/
pdutils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// pdutils.c
// glance
//
// Created by Tiago Rezende on 3/11/13.
// Copyright (c) 2013 Tiago Rezende. All rights reserved.
//
#include <stdio.h>
#include <string.h>
#include "m_pd.h"
#include "pdutils.h"
char *list_to_string(int argc, t_atom *argv) {
char str[MAXPDSTRING];
char buf[MAXPDSTRING];
str[0] = 0;
if (argc > 0) {
atom_string(argv, buf, MAXPDSTRING);
if (argc > 1) {
sprintf(str, "%s %s", buf, list_to_string(argc-1, argv+1));
} else {
sprintf(str, "%s", buf);
}
}
return strdup(str);
}
int find_uint_for_sym(t_sym_uint_list *start, t_symbol *sym, unsigned *found) {
while (start->sym != NULL) {
if (gensym(start->sym) == sym) {
*found = start->val;
return 1;
}
start++;
}
return 0;
}
int find_int_for_sym(t_sym_uint_list *start, t_symbol *sym, int *found) {
while (start->sym != NULL) {
if (gensym(start->sym) == sym) {
*found = start->val;
return 1;
}
start++;
}
return 0;
}