Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aayush
purr-data
Commits
3c415a1a
Commit
3c415a1a
authored
Jun 16, 2014
by
pokergaming
Browse files
more reformatting (tabs to spaces, lining up curly braces, no line wraps, etc.)
parent
94606760
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
pd/src/s_file.c
View file @
3c415a1a
...
...
@@ -53,21 +53,21 @@ static void sys_initloadpreferences( void)
{
char
filenamebuf
[
FILENAME_MAX
],
*
homedir
=
getenv
(
"HOME"
);
int
fd
,
length
;
char
user_prefs_file
[
FILENAME_MAX
];
/* user prefs file */
char
user_prefs_file
[
FILENAME_MAX
];
/* user prefs file */
/* default prefs embedded in the package */
char
default_prefs_file
[
FILENAME_MAX
];
char
default_prefs_file
[
FILENAME_MAX
];
struct
stat
statbuf
;
snprintf
(
default_prefs_file
,
FILENAME_MAX
,
"%s/default.pdl2ork"
,
sys_libdir
->
s_name
);
snprintf
(
default_prefs_file
,
FILENAME_MAX
,
"%s/default.pdl2ork"
,
sys_libdir
->
s_name
);
if
(
homedir
)
snprintf
(
user_prefs_file
,
FILENAME_MAX
,
"%s/.pdl2ork"
,
homedir
);
if
(
stat
(
user_prefs_file
,
&
statbuf
)
==
0
)
strncpy
(
filenamebuf
,
user_prefs_file
,
FILENAME_MAX
);
else
if
(
stat
(
default_prefs_file
,
&
statbuf
)
==
0
)
strncpy
(
filenamebuf
,
default_prefs_file
,
FILENAME_MAX
);
else
snprintf
(
user_prefs_file
,
FILENAME_MAX
,
"%s/.pdl2ork"
,
homedir
);
if
(
stat
(
user_prefs_file
,
&
statbuf
)
==
0
)
strncpy
(
filenamebuf
,
user_prefs_file
,
FILENAME_MAX
);
else
if
(
stat
(
default_prefs_file
,
&
statbuf
)
==
0
)
strncpy
(
filenamebuf
,
default_prefs_file
,
FILENAME_MAX
);
else
return
;
filenamebuf
[
FILENAME_MAX
-
1
]
=
0
;
if
((
fd
=
open
(
filenamebuf
,
0
))
<
0
)
...
...
@@ -240,38 +240,38 @@ static int sys_getpreference(const char *key, char *value, int size)
{
char
cmdbuf
[
256
];
int
nread
=
0
,
nleft
=
size
;
char
default_prefs
[
FILENAME_MAX
];
// default prefs embedded in the package
char
embedded_prefs
[
FILENAME_MAX
];
// overrides others for standalone app
char
embedded_prefs_file
[
FILENAME_MAX
];
char
user_prefs_file
[
FILENAME_MAX
];
char
*
homedir
=
getenv
(
"HOME"
);
char
default_prefs
[
FILENAME_MAX
];
// default prefs embedded in the package
char
embedded_prefs
[
FILENAME_MAX
];
// overrides others for standalone app
char
embedded_prefs_file
[
FILENAME_MAX
];
char
user_prefs_file
[
FILENAME_MAX
];
char
*
homedir
=
getenv
(
"HOME"
);
struct
stat
statbuf
;
/* the 'defaults' command expects the filename without .plist at the end */
snprintf
(
default_prefs
,
FILENAME_MAX
,
"%s/../org.puredata.pdl2ork.default"
,
sys_libdir
->
s_name
);
snprintf
(
embedded_prefs
,
FILENAME_MAX
,
"%s/../org.puredata.pdl2ork"
,
sys_libdir
->
s_name
);
snprintf
(
embedded_prefs_file
,
FILENAME_MAX
,
"%s.plist"
,
embedded_prefs
);
snprintf
(
user_prefs_file
,
FILENAME_MAX
,
"%s/Library/Preferences/org.puredata.pdl2ork.plist"
,
homedir
);
if
(
stat
(
embedded_prefs_file
,
&
statbuf
)
==
0
)
{
snprintf
(
cmdbuf
,
FILENAME_MAX
+
20
,
"defaults read '%s' %s 2> /dev/null
\n
"
,
embedded_prefs
,
key
);
/* the 'defaults' command expects the filename without .plist at the end */
snprintf
(
default_prefs
,
FILENAME_MAX
,
"%s/../org.puredata.pdl2ork.default"
,
sys_libdir
->
s_name
);
snprintf
(
embedded_prefs
,
FILENAME_MAX
,
"%s/../org.puredata.pdl2ork"
,
sys_libdir
->
s_name
);
snprintf
(
embedded_prefs_file
,
FILENAME_MAX
,
"%s.plist"
,
embedded_prefs
);
snprintf
(
user_prefs_file
,
FILENAME_MAX
,
"%s/Library/Preferences/org.puredata.pdl2ork.plist"
,
homedir
);
if
(
stat
(
embedded_prefs_file
,
&
statbuf
)
==
0
)
{
snprintf
(
cmdbuf
,
FILENAME_MAX
+
20
,
"defaults read '%s' %s 2> /dev/null
\n
"
,
embedded_prefs
,
key
);
strncpy
(
current_prefs
,
embedded_prefs
,
FILENAME_MAX
);
}
else
if
(
stat
(
user_prefs_file
,
&
statbuf
)
==
0
)
{
snprintf
(
cmdbuf
,
FILENAME_MAX
+
20
,
"defaults read org.puredata.pdl2ork %s 2> /dev/null
\n
"
,
key
);
}
else
if
(
stat
(
user_prefs_file
,
&
statbuf
)
==
0
)
{
snprintf
(
cmdbuf
,
FILENAME_MAX
+
20
,
"defaults read org.puredata.pdl2ork %s 2> /dev/null
\n
"
,
key
);
strcpy
(
current_prefs
,
"org.puredata.pdl2ork"
);
}
else
{
snprintf
(
cmdbuf
,
FILENAME_MAX
+
20
,
"defaults read '%s' %s 2> /dev/null
\n
"
,
default_prefs
,
key
);
}
else
{
snprintf
(
cmdbuf
,
FILENAME_MAX
+
20
,
"defaults read '%s' %s 2> /dev/null
\n
"
,
default_prefs
,
key
);
strcpy
(
current_prefs
,
"org.puredata.pdl2ork"
);
}
}
FILE
*
fp
=
popen
(
cmdbuf
,
"r"
);
while
(
nread
<
size
)
{
...
...
pd/src/s_inter.c
View file @
3c415a1a
...
...
@@ -705,9 +705,9 @@ void sys_vgui(char *fmt, ...)
msglen
=
sys_guibufsize
-
sys_guibufhead
;
}
if
(
sys_debuglevel
&
DEBUG_MESSUP
)
{
//blargh();
//blargh();
fprintf
(
stderr
,
"%s"
,
sys_guibuf
+
sys_guibufhead
);
}
}
sys_guibufhead
+=
msglen
;
sys_bytessincelastping
+=
msglen
;
}
...
...
@@ -861,8 +861,8 @@ void sys_unqueuegui(void *client)
int
sys_pollgui
(
void
)
{
// return (sys_domicrosleep(0, 1) || sys_poll_togui());
// "fix" for sluggish gui proposed by Miller on 12/16/2012
return
(
sys_domicrosleep
(
0
,
1
)
+
sys_poll_togui
());
// "fix" for sluggish gui proposed by Miller on 12/16/2012
return
(
sys_domicrosleep
(
0
,
1
)
+
sys_poll_togui
());
}
...
...
@@ -1182,7 +1182,7 @@ int sys_startgui(const char *guidir)
if
(
sys_hipriority
==
-
1
)
sys_hipriority
=
1
;
//(!getuid() || !geteuid());
sprintf
(
cmdbuf
,
"%s/pd-watchdog
\n
"
,
guidir
);
sprintf
(
cmdbuf
,
"%s/pd-watchdog
\n
"
,
guidir
);
if
(
sys_hipriority
)
{
/* To prevent lockup, we fork off a watchdog process with
...
...
@@ -1326,16 +1326,19 @@ extern int do_not_redraw;
void
glob_quit
(
void
*
dummy
)
{
//If we're going to try to cleanly close everything here, we should do the same for all open
//patches and that is currently not the case, so for the time being, let's just leave OS to deal
//with freeing of all memory when the program exits...
//let's try to cleanly remove invisible template canvases
//if (garray_arraytemplatecanvas) canvas_free( (t_canvas *)garray_arraytemplatecanvas);
//if (garray_floattemplatecanvas) canvas_free( (t_canvas *)garray_floattemplatecanvas);
canvas_suspend_dsp
();
do_not_redraw
=
1
;
glob_closeall
(
0
,
1
);
/* If we're going to try to cleanly close everything here, we should
do the same for all open patches and that is currently not the case,
so for the time being, let's just leave OS to deal with freeing of all
memory when the program exits... */
/* Let's try to cleanly remove invisible template canvases */
//if (garray_arraytemplatecanvas)
// canvas_free((t_canvas *)garray_arraytemplatecanvas);
//if (garray_floattemplatecanvas)
// canvas_free( (t_canvas *)garray_floattemplatecanvas);
canvas_suspend_dsp
();
do_not_redraw
=
1
;
glob_closeall
(
0
,
1
);
sys_vgui
(
"exit
\n
"
);
if
(
!
sys_nogui
)
{
...
...
pd/src/s_main.c
View file @
3c415a1a
...
...
@@ -47,11 +47,11 @@ int sys_noloadbang;
int
sys_nogui
;
int
sys_hipriority
=
-
1
;
/* -1 = don't care; 0 = no; 1 = yes */
int
sys_guisetportnumber
;
/* if started from the GUI, this is the port # */
int
sys_nosleep
=
0
;
/* skip all "sleep" calls and spin instead */
int
sys_console
=
0
;
/* default settings for the console is off */
int
sys_k12_mode
=
0
;
/* by default k12 mode is off */
int
sys_unique
=
0
;
/* by default off, prevents multiple instances
of pd-l2ork */
int
sys_nosleep
=
0
;
/* skip all "sleep" calls and spin instead */
int
sys_console
=
0
;
/* default settings for the console is off */
int
sys_k12_mode
=
0
;
/* by default k12 mode is off */
int
sys_unique
=
0
;
/* by default off, prevents multiple instances
of pd-l2ork */
char
*
sys_guicmd
;
t_symbol
*
sys_libdir
;
t_symbol
*
sys_guidir
;
...
...
@@ -167,18 +167,24 @@ static void openit(const char *dirname, const char *filename)
{
close
(
fd
);
glob_evalfile
(
0
,
gensym
(
nameptr
),
gensym
(
dirbuf
));
sys_vgui
(
"pdtk_set_current_dir %s
\n
"
,
filename
);
sys_vgui
(
"pdtk_set_current_dir %s
\n
"
,
filename
);
//sys_vgui("::pd_menus::update_recentfiles_menu .mbar.file 0\n");
if
(
strstr
(
filename
,
dirname
)
!=
NULL
)
{
// when opening files from a command line (at startup), filename contains full path
// so, if dirname is already included in filename we only pass filename variable
// otherwise combine the two and send them together
if
(
strstr
(
filename
,
dirname
)
!=
NULL
)
{
/* when opening files from a command line (at startup), filename
contains full path so, if dirname is already included in
filename we only pass filename variable otherwise combine the
two and send them together */
#ifndef MSW
sys_vgui
(
"::pd_guiprefs::update_recentfiles %s/%s 1
\n
"
,
dirname
,
filename
);
sys_vgui
(
"::pd_guiprefs::update_recentfiles %s/%s 1
\n
"
,
dirname
,
filename
);
#else
sys_vgui
(
"::pd_guiprefs::update_recentfiles %s\%s 1
\n
"
,
dirname
,
filename
);
sys_vgui
(
"::pd_guiprefs::update_recentfiles %s\%s 1
\n
"
,
dirname
,
filename
);
#endif
}
else
{
}
else
{
sys_vgui
(
"::pd_guiprefs::update_recentfiles %s 1
\n
"
,
filename
);
}
}
...
...
@@ -218,8 +224,8 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
sys_fontlist
[
i
].
fi_hostfontsize
=
atom_getintarg
(
3
*
best
+
2
,
argc
,
argv
);
sys_fontlist
[
i
].
fi_width
=
atom_getintarg
(
3
*
best
+
3
,
argc
,
argv
);
sys_fontlist
[
i
].
fi_height
=
atom_getintarg
(
3
*
best
+
4
,
argc
,
argv
);
sys_fontlist
[
i
].
fi_maxwidth
=
sys_fontlist
[
i
].
fi_width
;
sys_fontlist
[
i
].
fi_maxheight
=
sys_fontlist
[
i
].
fi_height
;
sys_fontlist
[
i
].
fi_maxwidth
=
sys_fontlist
[
i
].
fi_width
;
sys_fontlist
[
i
].
fi_maxheight
=
sys_fontlist
[
i
].
fi_height
;
}
#if 0
for (i = 0; i < 6; i++)
...
...
@@ -258,8 +264,9 @@ static void pd_makeversion(void)
{
char
foo
[
100
];
//snprintf(foo, sizeof(foo), "Pd-l2ork version %d.%d-%d%s\n", PD_MAJOR_VERSION,
// PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION);
//snprintf(foo, sizeof(foo), "Pd-l2ork version %d.%d-%d%s\n",
// PD_MAJOR_VERSION, PD_MINOR_VERSION,
// PD_BUGFIX_VERSION, PD_TEST_VERSION);
snprintf
(
foo
,
sizeof
(
foo
),
"Pd-L2Ork version %s
\n
"
,
PD_TEST_VERSION
);
...
...
@@ -300,28 +307,35 @@ int sys_main(int argc, char **argv)
return
(
1
);
/* check if we are unique, otherwise, just focus existing
instance, and if necessary open file inside it */
\
if
(
sys_openlist
)
{
if
(
sys_openlist
)
{
// let's create one continuous string from all files
int
length
=
0
;
t_namelist
*
nl
;
for
(
nl
=
sys_openlist
;
nl
;
nl
=
nl
->
nl_next
)
length
=
length
+
strlen
(
nl
->
nl_string
)
+
1
;
if
((
filenames
=
malloc
(
length
))
!=
NULL
)
{
if
((
filenames
=
malloc
(
length
))
!=
NULL
)
{
filenames
[
0
]
=
'\0'
;
// ensures the memory is an empty string
if
(
sys_openlist
)
{
for
(
nl
=
sys_openlist
;
nl
;
nl
=
nl
->
nl_next
)
{
if
(
sys_openlist
)
{
for
(
nl
=
sys_openlist
;
nl
;
nl
=
nl
->
nl_next
)
{
strcat
(
filenames
,
nl
->
nl_string
);
if
(
nl
->
nl_next
)
strcat
(
filenames
,
" "
);
}
}
//fprintf(stderr,"final list: <%s>\n", filenames);
}
else
{
}
else
{
error
(
"filelist malloc failed!
\n
"
);
return
(
1
);
}
}
sys_vgui
(
"pdtk_check_unique %d %s
\n
"
,
sys_unique
,
(
filenames
?
filenames
:
"0"
));
sys_vgui
(
"pdtk_check_unique %d %s
\n
"
,
sys_unique
,
(
filenames
?
filenames
:
"0"
));
if
(
sys_externalschedlib
)
return
(
sys_run_scheduler
(
sys_externalschedlibname
,
sys_extraflagsstring
));
...
...
@@ -333,13 +347,14 @@ int sys_main(int argc, char **argv)
sys_reopen_midi
();
sys_reopen_audio
();
if
(
sys_console
)
sys_vgui
(
"pdtk_toggle_console 1
\n
"
);
if
(
sys_k12_mode
)
{
t_namelist
*
path
=
pd_extrapath
;
while
(
path
->
nl_next
)
path
=
path
->
nl_next
;
sys_vgui
(
"pdtk_enable_k12_mode %s
\n
"
,
path
->
nl_string
);
}
if
(
sys_console
)
sys_vgui
(
"pdtk_toggle_console 1
\n
"
);
if
(
sys_k12_mode
)
{
t_namelist
*
path
=
pd_extrapath
;
while
(
path
->
nl_next
)
path
=
path
->
nl_next
;
sys_vgui
(
"pdtk_enable_k12_mode %s
\n
"
,
path
->
nl_string
);
}
/* run scheduler until it quits */
return
(
m_mainloop
());
...
...
@@ -533,7 +548,8 @@ void sys_findprogdir(char *progname)
sys_guidir
=
&
s_
;
/* in MSW the guipath just depends on the libdir */
#else
char
*
res
=
realpath
(
sbuf2
,
sbuf
);
if
(
!
res
)
{
if
(
!
res
)
{
error
(
"%s: Cannot get a real path"
,
sbuf2
);
}
strncpy
(
sbuf2
,
sbuf
,
FILENAME_MAX
-
30
);
...
...
@@ -612,7 +628,8 @@ int sys_argparse(int argc, char **argv)
argc
-=
2
;
argv
+=
2
;
}
else
if
(
!
strcmp
(
*
argv
,
"-soundbuf"
)
||
!
strcmp
(
*
argv
,
"-audiobuf"
)
&&
(
argc
>
1
))
else
if
(
!
strcmp
(
*
argv
,
"-soundbuf"
)
||
!
strcmp
(
*
argv
,
"-audiobuf"
)
&&
(
argc
>
1
))
{
sys_main_advance
=
atoi
(
argv
[
1
]);
argc
-=
2
;
argv
+=
2
;
...
...
@@ -822,12 +839,12 @@ int sys_argparse(int argc, char **argv)
sys_printtostderr
=
sys_nogui
=
1
;
argc
--
;
argv
++
;
}
else
if
(
!
strcmp
(
*
argv
,
"-console"
))
else
if
(
!
strcmp
(
*
argv
,
"-console"
))
{
sys_console
=
1
;
argc
--
;
argv
++
;
}
else
if
(
!
strcmp
(
*
argv
,
"-k12"
))
else
if
(
!
strcmp
(
*
argv
,
"-k12"
))
{
sys_k12_mode
=
1
;
argc
--
;
argv
++
;
...
...
pd/src/s_path.c
View file @
3c415a1a
...
...
@@ -80,43 +80,43 @@ static void sys_path_replace(
char
const
*
const
pattern
,
char
const
*
const
replacement
)
{
size_t
const
replen
=
strlen
(
replacement
);
size_t
const
patlen
=
strlen
(
pattern
);
size_t
const
orilen
=
strlen
(
original
);
size_t
patcnt
=
0
;
const
char
*
oriptr
;
const
char
*
patloc
;
// find how many times the pattern occurs in the original string
for
(
oriptr
=
original
;
patloc
=
strstr
(
oriptr
,
pattern
);
oriptr
=
patloc
+
patlen
)
{
patcnt
++
;
}
{
// allocate memory for the new string
size_t
const
retlen
=
orilen
+
patcnt
*
(
replen
-
patlen
);
if
(
returned
!=
NULL
)
{
// copy the original string,
// replacing all the instances of the pattern
char
*
retptr
=
returned
;
for
(
oriptr
=
original
;
patloc
=
strstr
(
oriptr
,
pattern
);
oriptr
=
patloc
+
patlen
)
{
size_t
const
skplen
=
patloc
-
oriptr
;
// copy the section until the occurence of the pattern
strncpy
(
retptr
,
oriptr
,
skplen
);
retptr
+=
skplen
;
// copy the replacement
strncpy
(
retptr
,
replacement
,
replen
);
retptr
+=
replen
;
}
// copy the rest of the string.
strcpy
(
retptr
,
oriptr
);
}
}
size_t
const
replen
=
strlen
(
replacement
);
size_t
const
patlen
=
strlen
(
pattern
);
size_t
const
orilen
=
strlen
(
original
);
size_t
patcnt
=
0
;
const
char
*
oriptr
;
const
char
*
patloc
;
// find how many times the pattern occurs in the original string
for
(
oriptr
=
original
;
patloc
=
strstr
(
oriptr
,
pattern
);
oriptr
=
patloc
+
patlen
)
{
patcnt
++
;
}
{
// allocate memory for the new string
size_t
const
retlen
=
orilen
+
patcnt
*
(
replen
-
patlen
);
if
(
returned
!=
NULL
)
{
// copy the original string,
// replacing all the instances of the pattern
char
*
retptr
=
returned
;
for
(
oriptr
=
original
;
patloc
=
strstr
(
oriptr
,
pattern
);
oriptr
=
patloc
+
patlen
)
{
size_t
const
skplen
=
patloc
-
oriptr
;
// copy the section until the occurence of the pattern
strncpy
(
retptr
,
oriptr
,
skplen
);
retptr
+=
skplen
;
// copy the replacement
strncpy
(
retptr
,
replacement
,
replen
);
retptr
+=
replen
;
}
// copy the rest of the string.
strcpy
(
retptr
,
oriptr
);
}
}
}
/* expand env vars and ~ at the beginning of a path and make a copy to return */
...
...
@@ -148,21 +148,24 @@ static void sys_expandpath(const char *from, char *to)
/* used for expanding paths for various objects */
void
sys_expandpathelems
(
const
char
*
name
,
char
*
result
)
{
//check for expandable elements in path (e.g. @pd_extra, ~/) and replace
//fprintf(stderr,"sys_expandpathelems name=<%s>\n", name);
char
interim
[
FILENAME_MAX
];
if
(
strstr
(
name
,
"@pd_extra"
)
!=
NULL
)
{
t_namelist
*
path
=
pd_extrapath
;
while
(
path
->
nl_next
)
path
=
path
->
nl_next
;
sys_path_replace
(
name
,
interim
,
"@pd_extra"
,
path
->
nl_string
);
//fprintf(stderr,"path->nl_string=<%s>\n", path->nl_string);
}
else
{
strcpy
(
interim
,
name
);
}
//fprintf(stderr,"sys_expandpathelems interim=<%s>\n", interim);
sys_expandpath
(
interim
,
result
);
//fprintf(stderr,"sys_expandpathelems result=<%s>\n", result);
//check for expandable elements in path (e.g. @pd_extra, ~/) and replace
//fprintf(stderr,"sys_expandpathelems name=<%s>\n", name);
char
interim
[
FILENAME_MAX
];
if
(
strstr
(
name
,
"@pd_extra"
)
!=
NULL
)
{
t_namelist
*
path
=
pd_extrapath
;
while
(
path
->
nl_next
)
path
=
path
->
nl_next
;
sys_path_replace
(
name
,
interim
,
"@pd_extra"
,
path
->
nl_string
);
//fprintf(stderr,"path->nl_string=<%s>\n", path->nl_string);
}
else
{
strcpy
(
interim
,
name
);
}
//fprintf(stderr,"sys_expandpathelems interim=<%s>\n", interim);
sys_expandpath
(
interim
,
result
);
//fprintf(stderr,"sys_expandpathelems result=<%s>\n", result);
}
/* test if path is absolute or relative, based on leading /, env vars, ~, etc */
...
...
@@ -420,10 +423,10 @@ static int do_open_via_path(const char *dir, const char *name,
{
t_namelist
*
nl
;
int
fd
=
-
1
;
char
final_name
[
FILENAME_MAX
];
char
final_name
[
FILENAME_MAX
];
/* first check for @ and ~ (and later others) and replace */
sys_expandpathelems
(
name
,
final_name
);
/* first check for @ and ~ (and later others) and replace */
sys_expandpathelems
(
name
,
final_name
);
/* first check if "name" is absolute (and if so, try to open) */
if
(
sys_open_absolute
(
final_name
,
ext
,
dirresult
,
nameresult
,
size
,
bin
,
&
fd
))
...
...
@@ -438,7 +441,7 @@ static int do_open_via_path(const char *dir, const char *name,
for
(
nl
=
searchpath
;
nl
;
nl
=
nl
->
nl_next
)
if
((
fd
=
sys_trytoopenone
(
nl
->
nl_string
,
final_name
,
ext
,
dirresult
,
nameresult
,
size
,
bin
))
>=
0
)
goto
do_open_via_path_end
;
goto
do_open_via_path_end
;
/* next look in built-in paths like "extra" */
if
(
sys_usestdpath
)
...
...
@@ -451,7 +454,7 @@ static int do_open_via_path(const char *dir, const char *name,
*
nameresult
=
dirresult
;
return
(
-
1
);
do_open_via_path_end:
return
(
fd
);
return
(
fd
);
}
/* open via path, using the global search path. */
...
...
pd/src/t_tkcmd.c
View file @
3c415a1a
...
...
@@ -558,12 +558,12 @@ void tcl_mess(char *s)
int
result
;
// PRODUCTION VERSION
char
catch_s
[
strlen
(
s
)
+
10
];
sprintf
(
catch_s
,
"catch { %s }"
,
s
);
char
catch_s
[
strlen
(
s
)
+
10
];
sprintf
(
catch_s
,
"catch { %s }"
,
s
);
// DEBUGGING VERSION
//char catch_s[strlen(s)];
//sprintf(catch_s, "%s", s);
//char catch_s[strlen(s)];
//sprintf(catch_s, "%s", s);
Tcl_Obj
*
messageObjPtr
=
Tcl_NewStringObj
(
catch_s
,
-
1
);
Tcl_IncrRefCount
(
messageObjPtr
);
...
...
@@ -590,8 +590,8 @@ void pdgui_doevalfile(Tcl_Interp *interp, char *s)
if
(
Tcl_EvalFile
(
interp
,
buf
)
!=
TCL_OK
)
{
char
buf2
[
1000
];
const
char
*
trace
=
Tcl_GetVar
(
interp
,
"errorInfo"
,
TCL_GLOBAL_ONLY
);
printf
(
"error in file %s: %s
\n
"
,
buf
,
trace
);
const
char
*
trace
=
Tcl_GetVar
(
interp
,
"errorInfo"
,
TCL_GLOBAL_ONLY
);
printf
(
"error in file %s: %s
\n
"
,
buf
,
trace
);
sprintf
(
buf2
,
"puts [concat tcl: %s: can't open script]
\n
"
,
buf
);
tcl_mess
(
buf2
);
...
...
pd/src/x_arithmetic.c
View file @
3c415a1a
...
...
@@ -156,31 +156,32 @@ static void *binop1_pow_new(t_floatarg f)
static
void
binop1_pow_bang
(
t_binop
*
x
)
{
if
(
x
->
x_f1
>=
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
if
(
x
->
x_f2
<=
-
1
||
x
->
x_f2
>=
1
||
x
->
x_f2
==
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
{
pd_error
(
x
,
"pow: calculation resulted in a NaN"
);
outlet_float
(
x
->
x_obj
.
ob_outlet
,
0
);
}
if
(
x
->
x_f1
>=
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
if
(
x
->
x_f2
<=
-
1
||
x
->
x_f2
>=
1
||
x
->
x_f2
==
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
{
pd_error
(
x
,
"pow: calculation resulted in a NaN"
);
outlet_float
(
x
->
x_obj
.
ob_outlet
,
0
);
}
}
static
void
binop1_pow_float
(
t_binop
*
x
,
t_float
f
)
{
x
->
x_f1
=
f
;
if
(
x
->
x_f1
>=
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
if
(
x
->
x_f2
<=
-
1
||
x
->
x_f2
>=
1
||
x
->
x_f2
==
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
{
pd_error
(
x
,
"pow: calculation resulted in a NaN"
);
outlet_float
(
x
->
x_obj
.
ob_outlet
,
0
);
}
if
(
x
->
x_f1
>=
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
if
(
x
->
x_f2
<=
-
1
||
x
->
x_f2
>=
1
||
x
->
x_f2
==
0
)
outlet_float
(
x
->
x_obj
.
ob_outlet
,
powf
(
x
->
x_f1
,
x
->
x_f2
));
else
{
pd_error
(
x
,
"pow: calculation resulted in a NaN"
);
outlet_float
(
x
->
x_obj
.
ob_outlet
,
0
);
}
}
/* ------------------------ max -------------------------------- */
...
...
pd/src/x_connective.c
View file @
3c415a1a
...
...
@@ -381,7 +381,7 @@ static void sel1_symbol(t_sel1 *x, t_symbol *s)
static
void
sel1_bang
(
t_sel1
*
x
)
{
sel1_symbol
(
x
,
gensym
(
"bang"
));
sel1_symbol
(
x
,
gensym
(
"bang"
));
}
static
t_class
*
sel2_class
;
...
...
@@ -436,7 +436,7 @@ static void sel2_symbol(t_sel2 *x, t_symbol *s)
static
void
sel2_bang
(
t_sel2
*
x
)
{
sel2_symbol
(
x
,
gensym
(
"bang"
));
sel2_symbol
(
x
,
gensym
(
"bang"
));
}
static
void
sel2_free
(
t_sel2
*
x
)
...
...
@@ -513,7 +513,7 @@ void select_setup(void)
sizeof
(
t_sel2
),
0
,
0
);
class_addfloat
(
sel2_class
,
sel2_float
);
class_addsymbol
(
sel2_class
,
sel2_symbol
);
class_addbang
(
sel2_class
,
sel2_bang
);
class_addbang
(
sel2_class
,
sel2_bang
);
class_addcreator
((
t_newmethod
)
select_new
,
gensym
(
"select"
),
A_GIMME
,
0
);
class_addcreator
((
t_newmethod
)
select_new
,
gensym
(
"sel"
),
A_GIMME
,
0
);
...
...
@@ -545,7 +545,7 @@ typedef struct _route
t_routeelement
*
x_vec
;
t_outlet
*
x_rejectout
;
t_route_proxy
x_pxy
;
t_int
x_mixed
;
t_int
x_mixed
;
}
t_route
;
static
void
route_proxy_init
(
t_route_proxy
*
x
,
t_route
*
p
)
...
...
@@ -557,15 +557,15 @@ static void route_proxy_init(t_route_proxy *x, t_route *p)
static
void
route_proxy_float
(
t_route_proxy
*
x
,
t_float
f
)
{
t_route
*
p
=
(
t_route
*
)
x
->
parent
;
p
->
x_type
=
A_FLOAT
;
p
->
x_vec
->
e_w
.
w_float
=
f
;
p
->
x_type
=
A_FLOAT
;
p
->
x_vec
->
e_w
.
w_float
=
f
;
}
static
void
route_proxy_symbol
(
t_route_proxy
*
x
,
t_symbol
*
s
)
{
t_route
*
p
=
(
t_route
*
)
x
->
parent
;
p
->
x_type
=
A_SYMBOL
;
p
->
x_vec
->
e_w
.
w_symbol
=
s
;
p
->
x_type
=
A_SYMBOL
;