Name: | Dr. Aubrey McIntosh |
Web Site: | |
Code:
<hr>One sided EAGLE library pad.</hr> REMOVE G:/Programs2003/EAGLE-4.11/projects/library_local/test.lbr; OPEN G:/Programs2003/EAGLE-4.11/projects/library_local/test.lbr; Set Wire_bend 2; Set Select_factor 0; Set Undo_log off; Grid mic 1; Display All; DESCRIPTION ''; Edit ONESIDE.PAC; Layer 21; Wire 254.000000 (-10160.000000 7620.000000) (-10160.000000 -6350.000000); Layer 21; Wire 254.000000 (-10160.000000 -6350.000000) (11430.000000 -6350.000000); Layer 21; Wire 254.000000 (11430.000000 -6350.000000) (11430.000000 7620.000000); Layer 21; Wire 254.000000 (11430.000000 7620.000000) (-10160.000000 7620.000000); Change Drill 812.800000; Pad 1320.800000 Offset R270.0 'P$2' (-2540.000000 -1270.000000); Layer 16; CHANGE Roundness 0; SMD 6451.600000 3251.200000 -0 R180.0 'P$5' (-3810.000000 2540.000000); Layer 16; CHANGE Roundness 0; SMD 6451.600000 3251.200000 -0 R270.0 'P$6' (3810.000000 2540.000000); Layer 21; CHANGE FONT PROPORTIONAL; Change Size 1270.000000; Change Ratio 8; Text R0.0 'Wouter's Part' (-8890.000000 -5080.000000); Change Drill 1000.000000; Hole (-3810.000000 2540.000000); Change Drill 700.000000; Hole (3810.000000 2540.000000); DESCRIPTION '<b>One side</b>\n pad for Wouter.'; Edit ONESIDE.SYM; Pin 'P$1' I/O None Middle R0 Both 0 (-2540.000000 7620.000000); Pin 'P$2' I/O None Middle R0 Both 0 (-2540.000000 2540.000000); Pin 'P$3' I/O None Middle R0 Both 1 (-2540.000000 -7620.000000); Edit ONESIDE.DEV; DESCRIPTION '<b>Test Part </b> to obtain one side pad.'; PREFIX ''; VALUE Off; CHANGE Addlevel Next; CHANGE Swaplevel 0; ADD ONESIDE 'G$1' (0.000000 0.000000); PACKAGE 'ONESIDE' ''; TECHNOLOGY ''; CONNECT 'G$1.P$1' 'P$2'; CONNECT 'G$1.P$2' 'P$5'; CONNECT 'G$1.P$3' 'P$6'; WRITE; Set Undo_log On; Set Select_factor 0.02; Grid last;
(* Aubrey McIntosh, Ph.D. * Written de novo on Sept 10, 2003 * Highly similarity to 'producer consumer' studies in * Software Practice and Experience, N. Wirth, mid 70s expected * * A FIFO. * + * Multiple FIFOs * Fixed size for software simplicity. * 0 offset for buffer for efficiency. * The presence of all status in buffer structure allows any number to be used. * - * All buffers are the same size. * Powers of two are recommended. * * And a Stack. :-) * * Some language hints: * the '*' marker means to put the symbol into the .inc file, and it is read/write accessible. * the '-' marker means to put the symbol into the .inc file, but never write to it. * the 'VAR' parameter means to put the item's address on the call stack. * with these definitions, a compiler will let you declare a Buf, but not know where any * field is except for read-only access to the 'result' at Buf+10 *) MODULE PICQueue; CONST BufSize* = 8; FullPut* = 1; EmptyRead* = 2; TYPE Buf* = RECORD buf : ARRAY BufSize OF CHAR; nextIn, thisOut : SHORTINT; result- : SET END; VAR SystemVariableStack- : Buf; PROCEDURE Add* ( ch : CHAR; VAR this : Buf ); BEGIN IF Available (this) <= BufSize THEN INCL ( this.result, FullPut ); RETURN (*Return, do not clobber existing data. *) END; this.buf [this.nextIn] := ch; this.nextIn := (this.nextIn+1) MOD BufSize END Add; PROCEDURE Fetch* ( VAR this : Buf ) : CHAR; VAR ch : CHAR; BEGIN IF 0 = Available (this) THEN INCL (this.result, EmptyRead); RETURN "!" (* Return, do not break correctness of Buf data *) END; ch := this.buf [this.thisOut]; this.thisOut := (this.thisOut+1) MOD BufSize; RETURN ch END Fetch; PROCEDURE Available* (VAR this : Buf) : SHORTINT; BEGIN RETURN ( BufSize + this.nextIn - this.thisOut ) MOD BufSize END Available; (* Add and Push are the same. *) PROCEDURE Pop* ( VAR this : Buf ) : CHAR; BEGIN IF this.nextIn = 0 THEN INCL (this.result, EmptyRead); HALT (42) (* A hard error. Let the WDT kick in. *) END; (* Please look at your clocks and remember: * 11 MOD 12 --> 11 * 12 MOD 12 --> 0 * -1 MOD 12 --> 11 *) this.nextIn := (this.nextIn-1) MOD BufSize; RETURN this.buf [this.nextIn] END Pop; PROCEDURE Init* (VAR this : Buf); BEGIN this.nextIn := 0; this.thisOut := 0; this.result := {} END Init; BEGIN Init( SystemVariableStack ) END PICQueue. Compiler.Compile *\s