Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
nerrons
purr-data
Commits
aa403dad
Commit
aa403dad
authored
Dec 14, 2016
by
Jonathan Wilkes
Browse files
Merge branch 'aggraef/purr-data-dollar-substitutions'
parents
58a885c9
ddc199e5
Changes
5
Hide whitespace changes
Inline
Side-by-side
pd/nw/dialog_canvas.html
View file @
aa403dad
...
...
@@ -567,9 +567,14 @@ function apply() {
for
(
i
=
0
;
i
<
pd_garray_attrs
.
length
;
i
++
)
{
attrs
=
pd_garray_attrs
[
i
];
name
=
get_array_value
(
"
array_name
"
,
attrs
);
if
(
name
.
slice
(
0
,
1
)
===
"
$
"
)
{
name
=
"
#
"
+
name
.
slice
(
1
);
var
arr
=
name
.
split
(
""
);
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
===
"
$
"
&&
i
+
1
<
arr
.
length
&&
arr
[
i
+
1
]
>=
"
0
"
&&
arr
[
i
+
1
]
<=
"
9
"
)
{
arr
[
i
]
=
"
#
"
;
}
}
name
=
arr
.
join
(
""
);
pdgui
.
pdsend
(
get_array_value
(
"
array_gfxstub
"
,
attrs
),
"
arraydialog
"
,
...
...
pd/nw/dialog_gatom.html
View file @
aa403dad
...
...
@@ -177,15 +177,16 @@ function strip_problem_chars(arg) {
}
function
gatom_escape
(
str
)
{
var
arr
,
i
,
ret
;
var
ret
;
if
(
str
.
length
===
0
)
{
ret
=
"
-
"
;
}
else
if
(
str
.
slice
(
0
,
1
)
===
"
-
"
)
{
ret
=
"
-
"
+
str
;
}
else
{
arr
=
str
.
split
(
""
);
for
(
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
===
"
$
"
)
{
var
arr
=
str
.
split
(
""
);
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
===
"
$
"
&&
i
+
1
<
arr
.
length
&&
arr
[
i
+
1
]
>=
"
0
"
&&
arr
[
i
+
1
]
<=
"
9
"
)
{
arr
[
i
]
=
"
#
"
;
}
}
...
...
@@ -194,6 +195,22 @@ function gatom_escape(str) {
return
strip_problem_chars
(
ret
);
}
function
gatom_unescape
(
str
)
{
if
(
str
.
slice
(
0
,
1
)
===
"
-
"
)
{
str
=
str
.
slice
(
1
);
}
else
{
var
arr
=
str
.
split
(
""
);
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
===
"
#
"
&&
i
+
1
<
arr
.
length
&&
arr
[
i
+
1
]
>=
"
0
"
&&
arr
[
i
+
1
]
<=
"
9
"
)
{
arr
[
i
]
=
"
$
"
;
}
}
str
=
arr
.
join
(
""
);
}
return
str
;
}
function
update_attr
(
elem
)
{
new_attrs
[
elem
.
name
]
=
elem
.
value
;
}
...
...
@@ -306,11 +323,11 @@ function populate_form(attributes) {
get_elem
(
"
draglo
"
).
value
=
attributes
.
draglo
;
get_elem
(
"
draghi
"
).
value
=
attributes
.
draghi
;
label
=
attributes
.
label
;
get_elem
(
"
label
"
).
value
=
label
===
"
-
"
?
""
:
label
;
get_elem
(
"
label
"
).
value
=
gatom_unescape
(
label
)
;
snd
=
attributes
.
send_symbol
;
get_elem
(
"
send_symbol
"
).
value
=
snd
===
"
-
"
?
""
:
snd
;
get_elem
(
"
send_symbol
"
).
value
=
gatom_unescape
(
snd
)
;
rcv
=
attributes
.
receive_symbol
;
get_elem
(
"
receive_symbol
"
).
value
=
rcv
===
"
-
"
?
""
:
rcv
;
get_elem
(
"
receive_symbol
"
).
value
=
gatom_unescape
(
rcv
)
;
labelpos
=
attributes
.
labelpos
;
radios
=
document
.
getElementsByName
(
"
labelpos
"
);
...
...
pd/nw/dialog_iemgui.html
View file @
aa403dad
...
...
@@ -371,16 +371,33 @@ function update_attr(elem) {
}
//Clean up strings to send as symbol arguments to Pd
function
pd_symbol_carwash
(
s
)
{
function
iemgui_escape
(
s
)
{
s
=
!
s
?
"
empty
"
:
s
;
if
(
s
.
charAt
(
0
)
===
"
$
"
)
{
s
=
"
#
"
+
s
.
slice
(
1
);
var
arr
=
s
.
split
(
""
);
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
===
"
$
"
&&
i
+
1
<
arr
.
length
&&
arr
[
i
+
1
]
>=
"
0
"
&&
arr
[
i
+
1
]
<=
"
9
"
)
{
arr
[
i
]
=
"
#
"
;
}
}
s
=
arr
.
join
(
""
);
s
=
substitute_space
(
s
);
s
=
strip_problem_chars
(
s
);
return
s
;
}
function
iemgui_unescape
(
s
)
{
var
arr
=
s
.
split
(
""
);
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
===
"
#
"
&&
i
+
1
<
arr
.
length
&&
arr
[
i
+
1
]
>=
"
0
"
&&
arr
[
i
+
1
]
<=
"
9
"
)
{
arr
[
i
]
=
"
$
"
;
}
}
s
=
arr
.
join
(
""
);
return
s
;
}
function
send_params
(
attrs
,
create_undo_point
)
{
/* Not sure what these are...
iemgui_clip_dim $id
...
...
@@ -394,9 +411,9 @@ function send_params(attrs, create_undo_point) {
var
send_symbol
=
attrs
.
send_symbol
,
receive_symbol
=
attrs
.
receive_symbol
,
label
=
attrs
[
"
label
"
];
send_symbol
=
pd_symbol_carwash
(
send_symbol
);
receive_symbol
=
pd_symbol_carwash
(
receive_symbol
);
label
=
pd_symbol_carwash
(
label
);
send_symbol
=
iemgui_escape
(
send_symbol
);
receive_symbol
=
iemgui_escape
(
receive_symbol
);
label
=
iemgui_escape
(
label
);
var
label_x_offset
=
attrs
.
x_offset
;
var
label_y_offset
=
attrs
.
y_offset
;
...
...
@@ -605,6 +622,10 @@ function populate_form(attr_object) {
elem
[
0
].
checked
=
+
attr_object
[
attr
];
}
else
if
(
elem
[
0
].
type
===
"
select-one
"
)
{
elem
[
0
].
selectedIndex
=
+
attr_object
[
attr
];
}
else
if
(
attr
===
"
send_symbol
"
||
attr
===
"
receive_symbol
"
||
attr
===
"
label
"
)
{
elem
[
0
].
value
=
iemgui_unescape
(
attr_object
[
attr
]);
}
else
{
elem
[
0
].
value
=
attr_object
[
attr
];
}
...
...
pd/src/g_all_guis.c
View file @
aa403dad
...
...
@@ -53,7 +53,7 @@ t_symbol *iemgui_dollar2raute(t_symbol *s)
return
(
s
);
for
(
s1
=
s
->
s_name
,
s2
=
buf
;
;
s1
++
,
s2
++
)
{
if
(
*
s1
==
'$'
)
if
(
*
s1
==
'$'
&&
*
s1
&&
isdigit
(
s1
[
1
])
)
*
s2
=
'#'
;
else
if
(
!
(
*
s2
=
*
s1
))
break
;
...
...
@@ -68,7 +68,7 @@ t_symbol *iemgui_raute2dollar(t_symbol *s)
return
(
s
);
for
(
s1
=
s
->
s_name
,
s2
=
buf
;
;
s1
++
,
s2
++
)
{
if
(
*
s1
==
'#'
)
if
(
*
s1
==
'#'
&&
*
s1
&&
isdigit
(
s1
[
1
])
)
*
s2
=
'$'
;
else
if
(
!
(
*
s2
=
*
s1
))
break
;
...
...
pd/src/g_array.c
View file @
aa403dad
...
...
@@ -8,6 +8,7 @@
#include
"m_pd.h"
#include
"g_canvas.h"
#include
<math.h>
#include
<ctype.h>
extern
int
glob_lmclick
;
...
...
@@ -24,15 +25,17 @@ two, but how? */
t_symbol
*
sharptodollar
(
t_symbol
*
s
)
{
if
(
*
s
->
s_name
==
'#'
)
char
buf
[
MAXPDSTRING
],
*
s1
,
*
s2
;
if
(
strlen
(
s
->
s_name
)
>=
MAXPDSTRING
)
return
(
s
);
for
(
s1
=
s
->
s_name
,
s2
=
buf
;
;
s1
++
,
s2
++
)
{
char
buf
[
MAXPDSTRING
];
strncpy
(
buf
,
s
->
s_name
,
MAXPDSTRING
);
buf
[
MAXPDSTRING
-
1
]
=
0
;
buf
[
0
]
=
'$'
;
return
(
gensym
(
buf
));
if
(
*
s1
==
'#'
&&
*
s1
&&
isdigit
(
s1
[
1
]))
*
s2
=
'$'
;
else
if
(
!
(
*
s2
=
*
s1
))
break
;
}
else
return
(
s
);
return
(
gensym
(
buf
)
);
}
/* --------- "pure" arrays with scalars for elements. --------------- */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment