Update of /cvsroot/pure-data/externals/iem/comport/comport
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3573
Modified Files:
comport.c
Log Message:
help and verbose method for debug
Index: comport.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/comport/comport/comport.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** comport.c 1 May 2006 17:43:55 -0000 1.11
--- comport.c 1 May 2006 20:23:03 -0000 1.12
***************
*** 57,60 ****
--- 57,62 ----
double x_deltime;
+ int verbose;
+
} t_comport;
***************
*** 803,806 ****
--- 805,810 ----
clock_delay(x->x_clock, x->x_deltime);
+ x->verbose = 0;
+
return x;
}
***************
*** 810,814 ****
comport_free(t_comport *x)
{
! post("close serial...");
clock_unset(x->x_clock);
--- 814,818 ----
comport_free(t_comport *x)
{
! post("free serial...");
clock_unset(x->x_clock);
***************
*** 900,904 ****
sys_com_port[x->comport]);
}
! else post("set xonxoff of %s to %f\n",sys_com_port[x->comport],f);
}
--- 904,909 ----
sys_com_port[x->comport]);
}
! else if(x->verbose > 0)
! post("set xonxoff of %s to %f\n",sys_com_port[x->comport],f);
}
***************
*** 930,934 ****
--- 935,944 ----
if(x->comport >= 0 && x->comport < COMPORT_MAX){
sys_com_port[x->comport] = s->s_name;
+ if(x->verbose > 0)
+ post("comport %d: set devicename %s",x->comport,sys_com_port[x->comport]);
}
+ else if(x->verbose > 0)
+ post("comport %d: could not set devicename %s",x->comport,s->s_name);
+
}
***************
*** 948,951 ****
--- 958,993 ----
}
}
+ /* ---------------- HELPER ------------------------- */
+ static void comport_verbose(t_comport *x, t_floatarg f)
+ {
+ x->verbose = f;
+ if(f > 0)
+ post("Comport Verbose is on: %d", (int) f);
+ }
+
+
+ static void comport_help(t_comport *x)
+ {
+ post("Comport %d (baud %f):",x->comport,x->baud);
+ if(x->comport >= 0 && x->comport < COMPORT_MAX){
+ post("devicename: %s",sys_com_port[x->comport]);
+ }
+
+ post(" Methods:");
+ post(" baud <baud> ... set baudrate to nearest possible baud\n"
+ " bits <bits> ... set number of bits (7 or 8)\n"
+ " stopbit <0|1> ... set off|on stopbit\n"
+ " rtscts <0|1> ... set rts/cts off|on\n"
+ " parity <0|1> ... set parity off|on\n"
+ " xonxoff <0|1> ... set xon/xoff off|on\n"
+ " close ... close device\n"
+ " open <num> ... open device number num\n"
+ " devicename <d> ... set device name to s (eg. /dev/ttyS8)\n"
+ " print <list> ... print list of atoms on serial\n"
+ " pollintervall <t> ... set poll ibntervall to t ticks\n"
+ " verbose <level> ... for debug set verbosity to level\n"
+ " help ... post this help");
+ }
+
/* ---------------- SETUP OBJECTS ------------------ */
***************
*** 962,988 ****
class_addbang(comport_class, comport_bang
*/
! class_addmethod(comport_class, (t_method)comport_baud, gensym("baud"),
! A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_bits, gensym("bits"),
! A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_stopbit, gensym("stopbit"),
! A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_rtscts, gensym("rtscts"),
! A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_parity, gensym("parity"),
! A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_xonxoff, gensym("xonxoff"),
! A_FLOAT, 0);
class_addmethod(comport_class, (t_method)comport_close, gensym("close"), 0);
! class_addmethod(comport_class, (t_method)comport_open, gensym("open"),
! A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_devicename, gensym("devicename"),
! A_SYMBOL, 0);
! class_addmethod(comport_class, (t_method)comport_print, gensym("print"),
! A_GIMME, 0);
- class_addmethod(comport_class, (t_method)comport_pollintervall, gensym("pollintervall"),
- A_FLOAT, 0);
#ifndef _WIN32
null_tv.tv_sec = 0; /* no wait */
--- 1004,1023 ----
class_addbang(comport_class, comport_bang
*/
! class_addmethod(comport_class, (t_method)comport_baud, gensym("baud"),A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_bits, gensym("bits"), A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_stopbit, gensym("stopbit"), A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_rtscts, gensym("rtscts"), A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_parity, gensym("parity"), A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_xonxoff, gensym("xonxoff"), A_FLOAT, 0);
class_addmethod(comport_class, (t_method)comport_close, gensym("close"), 0);
! class_addmethod(comport_class, (t_method)comport_open, gensym("open"), A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_devicename, gensym("devicename"), A_SYMBOL, 0);
! class_addmethod(comport_class, (t_method)comport_print, gensym("print"), A_GIMME, 0);
! class_addmethod(comport_class, (t_method)comport_pollintervall, gensym("pollintervall"), A_FLOAT, 0);
!
! class_addmethod(comport_class, (t_method)comport_verbose, gensym("verbose"), A_FLOAT, 0);
! class_addmethod(comport_class, (t_method)comport_help, gensym("help"), 0);
#ifndef _WIN32
null_tv.tv_sec = 0; /* no wait */