Commit 3c415a1a authored by pokergaming's avatar pokergaming
Browse files

more reformatting (tabs to spaces, lining up curly braces, no line wraps, etc.)

parent 94606760
......@@ -1326,13 +1326,16 @@ 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);
/* 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);
......
......@@ -50,8 +50,8 @@ 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_unique = 0; /* by default off, prevents multiple instances
of pd-l2ork */
char *sys_guicmd;
t_symbol *sys_libdir;
t_symbol *sys_guidir;
......@@ -169,16 +169,22 @@ static void openit(const char *dirname, const char *filename)
glob_evalfile(0, gensym(nameptr), gensym(dirbuf));
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);
}
}
......@@ -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));
......@@ -334,7 +348,8 @@ int sys_main(int argc, char **argv)
sys_reopen_audio();
if (sys_console) sys_vgui("pdtk_toggle_console 1\n");
if (sys_k12_mode) {
if (sys_k12_mode)
{
t_namelist *path = pd_extrapath;
while (path->nl_next)
path = path->nl_next;
......@@ -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;
......
......@@ -151,13 +151,16 @@ 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) {
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 {
}
else
{
strcpy(interim, name);
}
//fprintf(stderr,"sys_expandpathelems interim=<%s>\n", interim);
......
......@@ -162,7 +162,8 @@ static void binop1_pow_bang(t_binop *x)
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 {
else
{
pd_error(x, "pow: calculation resulted in a NaN");
outlet_float(x->x_obj.ob_outlet, 0);
}
......
......@@ -605,7 +605,8 @@ static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv)
if (argc > 1 && argv[1].a_type == A_SYMBOL)
outlet_anything(e->e_outlet, argv[1].a_w.w_symbol,
argc-2, argv+2);
else {
else
{
if (argc > 1)
outlet_list(e->e_outlet, 0, argc-1, argv+1);
else
......@@ -693,10 +694,13 @@ static void *route_new(t_symbol *s, int argc, t_atom *argv)
for (n = 0, e = x->x_vec; n < argc; n++, e++)
{
e->e_outlet = outlet_new(&x->x_obj, &s_list);
if (argv[n].a_type == A_FLOAT) {
if (argv[n].a_type == A_FLOAT)
{
e->e_w.w_float = atom_getfloatarg(n, argc, argv);
flt = 1;
} else {
}
else
{
e->e_w.w_symbol = atom_getsymbolarg(n, argc, argv);
sym = 1;
}
......@@ -1068,7 +1072,8 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv)
{
t_atomtype thistype = ap->a_type;
char c;
if (thistype == TR_SYMBOL) {
if (thistype == TR_SYMBOL)
{
if (strlen(ap->a_w.w_symbol->s_name) == 1)
c = ap->a_w.w_symbol->s_name[0];
else if (strcmp(ap->a_w.w_symbol->s_name, "anything") == 0)
......@@ -1103,18 +1108,22 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv)
else if (c == 'a')
u->u_type = TR_ANYTHING,
u->u_outlet = outlet_new(&x->x_obj, &s_symbol);
else if (c == 'F') {
else if (c == 'F')
{
//static float
u->u_float = ap->a_w.w_float;
u->u_type = TR_STATIC_FLOAT;
u->u_outlet = outlet_new(&x->x_obj, &s_float);
}
else if (c == 'S') {
else if (c == 'S')
{
//static symbol
u->u_sym = *ap->a_w.w_symbol;
u->u_type = TR_STATIC_SYMBOL;
u->u_outlet = outlet_new(&x->x_obj, &s_symbol);
} else {
}
else
{
pd_error(x, "trigger: %s: bad type", ap->a_w.w_symbol->s_name);
u->u_type = TR_FLOAT, u->u_outlet = outlet_new(&x->x_obj, &s_float);
}
......@@ -1164,7 +1173,8 @@ static void trigger_anything(t_trigger *x, t_symbol *s, int argc, t_atom *argv)
{
if (u->u_type == TR_BANG)
outlet_bang(u->u_outlet);
else if (u->u_type == TR_ANYTHING) {
else if (u->u_type == TR_ANYTHING)
{
//fprintf(stderr,"TR_ANYTHING\n");
outlet_anything(u->u_outlet, s, argc, argv);
}
......@@ -1387,25 +1397,31 @@ static void makefilename_scanformat(t_makefilename *x)
char *str,*chr;
if (!x->x_format) return;
x->x_accept = A_NULL;
for (str=x->x_format->s_name; *str; str++) {
if (!infmt && *str=='%') {
for (str=x->x_format->s_name; *str; str++)
{
if (!infmt && *str=='%')
{
infmt=1;
continue;
}
if (infmt) {
if (infmt)
{
if (strchr("-.#0123456789",*str)!=0)
continue;
if (*str=='s') {
if (*str=='s')
{
x->x_accept = A_SYMBOL;
x->x_intconvert = 0;
break;
}
if (strchr("fgGeE",*str)!=0) {
if (strchr("fgGeE",*str)!=0)
{
x->x_accept = A_FLOAT;
x->x_intconvert = 0;
break;
}
if (strchr("xXdiouc",*str)!=0) {
if (strchr("xXdiouc",*str)!=0)
{
x->x_accept = A_FLOAT;
x->x_intconvert = 1;
break;
......@@ -1431,7 +1447,8 @@ static void *makefilename_new(t_symbol *s)
static void makefilename_float(t_makefilename *x, t_floatarg f)
{
char buf[MAXPDSTRING];
if (x->x_accept == A_FLOAT) {
if (x->x_accept == A_FLOAT)
{
if (x->x_intconvert)
sprintf(buf, x->x_format->s_name, (int)f);
else sprintf(buf, x->x_format->s_name, f);
......
......@@ -87,10 +87,13 @@ void gfxstub_new(t_pd *owner, void *key, const char *cmd)
sys_gui(buf);
}
int gfxstub_haveproperties(void *key) {
int gfxstub_haveproperties(void *key)
{
t_gfxstub *x;
for (x = gfxstub_list; x; x = x->x_next) {
if (x->x_key == key) {
for (x = gfxstub_list; x; x = x->x_next)
{
if (x->x_key == key)
{
return (t_int)x;
}
}
......
......@@ -148,7 +148,8 @@ void info_out(t_text *te, t_symbol *s, int argc, t_atom *argv)
postatom(argc, argv);
endpost();
}
else {
else
{
outlet_list(te->ob_outlet,
&s_list, argc, argv);
}
......
......@@ -64,7 +64,8 @@ void alist_init(t_alist *x)
void alist_clear(t_alist *x)
{
if (x->l_n) {
if (x->l_n)
{
int i;
for (i = 0; i < x->l_n; i++)
{
......@@ -362,7 +363,8 @@ static void list_cat_setup(void)
list_cat_proxy_class = class_new(gensym("list cat pxy"), 0, 0,
sizeof(t_list_cat_proxy), 0, 0);
class_addmethod(list_cat_proxy_class, (t_method)list_cat_proxy_clear, gensym("clear"), 0);
class_addmethod(list_cat_proxy_class, (t_method)list_cat_proxy_clear,
gensym("clear"), 0);
}
/* ------------- list prepend --------------------- */
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment