/* convert .* number pictures to C declarations */ count = 0 char. = "" plane0. = 0 plane1. = 0 l = readln(stdin) do while ~eof(stdin) count = count + 1 parse var l e char char.count = strip(char) if e ~= '=' then do say 'ERROR, expecting = as first character at:' say l exit 10 end do i = 1 to 10 l = readln(stdin) if eof(stdin) then do say 'unexpected EOF found' exit 10 end call makeplanes(count,l,i) end l = readln(stdin) end call writeln(stdout,"static UBYTE nums["count"][2][10] = {"); do j = 1 to count call writech(stdout," { {"plane0.j.1); do i = 2 to 10 call writech(stdout,","plane0.j.i); end call writeln(stdout,"},"); call writech(stdout," {"plane1.j.1); do i = 2 to 10 call writech(stdout,","plane1.j.i); end call writeln(stdout,"} }, /*" char.j "*/") end call writeln(stdout,"};"); exit makeplanes: procedure expose plane0. plane1. parse arg count,v,n v = strip(v) plane0 = 0 plane1 = 0 do i = 0 to length(v)-1 d = substr(v,i+1,1) plane0 = plane0 * 2 plane1 = plane1 * 2 if (d = 1 | d = 3) then plane0 = plane0 + 1 if (d = 2 | d = 3) then plane1 = plane1 + 1 end plane0.count.n = "0x"c2x(d2c(plane0)) plane1.count.n = "0x"c2x(d2c(plane1)) return