[PD-cvs] externals/hcs/hid Makefile,1.2,1.3 hid-help.pd,1.1,1.2 make-arrays-from-input.h.pl,1.2,1.3

Hans-Christoph Steiner eighthave at users.sourceforge.net
Wed Oct 20 04:55:15 CEST 2004


Update of /cvsroot/pure-data/externals/hcs/hid
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15171

Modified Files:
	Makefile hid-help.pd make-arrays-from-input.h.pl 
Log Message:
auto-generated event type/code listings as pd files

Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile	18 Oct 2004 21:10:48 -0000	1.2
--- Makefile	20 Oct 2004 02:55:12 -0000	1.3
***************
*** 45,51 ****
  
  input_arrays:
! 	./make-arrays-from-input.h.pl > input_arrays.h
  
  
! clean: ; rm -f *.pd_* *.o *~ input_arrays.h
  
--- 45,51 ----
  
  input_arrays:
! 	./make-arrays-from-input.h.pl
  
  
! clean: ; rm -f *.pd_* *.o *~ input_arrays.h ev*-list.pd
  

Index: hid-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid-help.pd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** hid-help.pd	20 Oct 2004 02:06:08 -0000	1.1
--- hid-help.pd	20 Oct 2004 02:55:12 -0000	1.2
***************
*** 1,37 ****
! #N canvas 282 80 613 460 10;
! #X msg 340 212 ev_rel rel_x 1 1.09824e+09;
! #X obj 340 191 prepend set;
! #X obj 102 357 route rel_x rel_y;
! #X floatatom 102 377 5 0 0 0 - - -;
! #X floatatom 159 377 5 0 0 0 - - -;
! #X obj 180 226 print;
! #X msg 106 48 start;
! #X msg 125 67 stop;
! #X obj 198 155 hid /dev/input/event0;
! #X floatatom 444 331 12 0 0 1 time - -;
! #X obj 351 311 unpack s s f f;
! #X msg 222 52 open /dev/input/event1;
! #X msg 214 29 open /dev/input/event0;
! #X msg 238 74 open /dev/input/event2;
! #X msg 250 95 open /dev/input/event3;
! #X msg 262 115 open /dev/input/event4;
! #X obj 43 292 route ev_key ev_rel ev_abs;
! #X floatatom 161 338 7 0 0 0 - - -;
! #X floatatom 219 338 7 0 0 0 - - -;
! #X obj 161 317 route abs_x abs_y;
! #X obj 44 52 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 1 1;
! #X floatatom 413 348 12 0 0 1 value - -;
! #X symbolatom 381 365 10 0 0 1 eventcode - -;
! #X symbolatom 351 384 15 0 0 1 eventtype - -;
! #X floatatom 43 422 5 0 0 0 - - -;
! #X floatatom 118 423 5 0 0 0 - - -;
! #X obj 43 400 route key_f key_leftctrl btn_left;
! #X floatatom 193 423 5 0 0 0 - - -;
! #X obj 11 166 bng 35 250 50 0 empty empty event_received 38 18 1 8
  -225280 -1 -1;
! #X obj 2 2 cnv 15 600 20 empty empty "hid" 2 11 1 18 -233017 -66577
! 0;
! #X text 312 234 outlet message format:;
! #X text 336 248 eventtype eventcode value timestamp;
  #X connect 1 0 0 0;
  #X connect 2 0 3 0;
--- 1,50 ----
! #N canvas 124 73 911 579 10;
! #X msg 382 241 ev_rel rel_x 5 1.09824e+09;
! #X obj 382 220 prepend set;
! #X obj 144 386 route rel_x rel_y;
! #X floatatom 144 406 5 0 0 0 - - -;
! #X floatatom 201 406 5 0 0 0 - - -;
! #X obj 222 255 print;
! #X msg 148 77 start;
! #X msg 167 96 stop;
! #X obj 240 184 hid /dev/input/event0;
! #X floatatom 486 360 12 0 0 1 time - -;
! #X obj 393 340 unpack s s f f;
! #X msg 264 81 open /dev/input/event1;
! #X msg 256 58 open /dev/input/event0;
! #X msg 280 103 open /dev/input/event2;
! #X msg 292 124 open /dev/input/event3;
! #X msg 304 144 open /dev/input/event4;
! #X obj 85 321 route ev_key ev_rel ev_abs;
! #X floatatom 203 367 7 0 0 0 - - -;
! #X floatatom 261 367 7 0 0 0 - - -;
! #X obj 203 346 route abs_x abs_y;
! #X obj 86 81 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 1;
! #X floatatom 455 377 12 0 0 1 value - -;
! #X symbolatom 423 394 10 0 0 1 eventcode - -;
! #X symbolatom 393 413 15 0 0 1 eventtype - -;
! #X floatatom 85 451 5 0 0 0 - - -;
! #X floatatom 160 452 5 0 0 0 - - -;
! #X obj 85 429 route key_f key_leftctrl btn_left;
! #X floatatom 235 452 5 0 0 0 - - -;
! #X obj 53 195 bng 35 250 50 0 empty empty event_received 38 18 1 8
  -225280 -1 -1;
! #X obj 2 2 cnv 15 900 20 empty empty hid 2 11 1 18 -233017 -66577 0
! ;
! #X text 354 263 outlet message format:;
! #X text 378 277 eventtype eventcode value timestamp;
! #X obj 742 104 ev-list;
! #X obj 742 155 ev_syn-list;
! #X obj 742 177 ev_key-list;
! #X obj 742 199 ev_rel-list;
! #X obj 742 221 ev_abs-list;
! #X obj 742 243 ev_msc-list;
! #X obj 742 265 ev_led-list;
! #X obj 742 287 ev_snd-list;
! #X obj 742 309 ev_rep-list;
! #X obj 742 331 ev_ff-list;
! #X obj 742 353 ev_ff_status-list;
! #X text 710 85 Event Types:;
! #X text 710 136 Event Codes:;
  #X connect 1 0 0 0;
  #X connect 2 0 3 0;

Index: make-arrays-from-input.h.pl
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/make-arrays-from-input.h.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** make-arrays-from-input.h.pl	18 Oct 2004 21:10:49 -0000	1.2
--- make-arrays-from-input.h.pl	20 Oct 2004 02:55:12 -0000	1.3
***************
*** 3,15 ****
  use Switch;
  
- # BUGS: FF_STATUS, REP, SND, SYN are not building properly. Its still dropping the first element
- 
- 
- #========================================================================
- # GLOBAL VARS
- #========================================================================
- 
- $FILENAME = "linux/input.h";
- 
  #========================================================================
  # FUNCTIONS
--- 3,6 ----
***************
*** 63,73 ****
  }
  
  #========================================================================
  # MAIN
  #========================================================================
  
! $FILENAME = "linux/input.h";
  
! open(INPUT_H, "<$FILENAME");
  
  while (<INPUT_H>)
--- 54,101 ----
  }
  
+ #------------------------------------------------------------------------
+ # print an array out in a comment table in Pd
+ #
+ sub printPdFile
+ {
+ 	 my @arrayToPrint = @_;
+ 	 my $x;
+ 	 my $y;
+ 	 my $lineNum = 1;
+ 
+ 	 my $PDFILENAME = "$arrayToPrint[0]-list.pd";
+ 	 open(PDFILE, ">$PDFILENAME");
+ 
+ 	 print(PDFILE "#N canvas 282 80 210 570 10;\n");
+ 	 if ($arrayToPrint[0] eq "ev") { print(PDFILE "#X text 5 5 Event Types;\n"); }
+ 	 else { print(PDFILE "#X text 5 5 Codes for Type: $arrayToPrint[0];\n"); }
+ 	 print(PDFILE "#X text 5 20 ----------------------------;\n");
+ 
+ 	 for($i = 1; $i <= $#arrayToPrint; $i++)
+ 	 {
+ 		  # if the array element's data is null, print NULL
+ 		  if ($arrayToPrint[$i]) 
+ 		  { 
+ 				$x = 5;
+ 				$y = $lineNum * 20 + 20;
+ 				print(PDFILE "#X text $x $y $arrayToPrint[$i];\n"); 
+ 				$lineNum++;
+ 		  }
+ 	 }
+ 
+ 	 close(PDFILE);
+ }
+ 
  #========================================================================
  # MAIN
  #========================================================================
  
! # source file
! $SOURCEFILENAME = "linux/input.h";
! open(INPUT_H, "<$SOURCEFILENAME");
  
! # output files
! $ARRAYSFILENAME = "input_arrays.h";
! open(ARRAYS, ">$ARRAYSFILENAME");
  
  while (<INPUT_H>)
***************
*** 102,105 ****
--- 130,150 ----
  }
  
+ # generate a .pd file for each array
+ printPdFile("ev", at EV);
+ printPdFile("ev_syn", at SYN);
+ printPdFile("ev_key", at KEY);
+ printPdFile("ev_rel", at REL);
+ printPdFile("ev_abs", at ABS);
+ printPdFile("ev_msc", at MSC);
+ printPdFile("ev_led", at LED);
+ printPdFile("ev_snd", at SND);
+ printPdFile("ev_rep", at REP);
+ printPdFile("ev_ff", at FF);
+ # there doesn't seem to be any PWR events yet...
+ #printPdFile("pwr", at PWR);
+ printPdFile("ev_ff_status", at FF_STATUS);
+ 
+ # generate a C array for each array and stick them all in the same file
+ select ARRAYS;
  printCArray("ev", at EV);
  printCArray("ev_syn", at SYN);
***************
*** 151,155 ****
  # print "FF_STATUS: $#FF_STATUS \n";
  
! 
  close(INPUT_H);
  
--- 196,200 ----
  # print "FF_STATUS: $#FF_STATUS \n";
  
! close(ARRAYS);
  close(INPUT_H);
  





More information about the Pd-cvs mailing list