• Home
  • Raw
  • Download

Lines Matching +full:write +full:- +full:output

6 # I, however, take full credit for any bugs, errors or difficulties :-)
24 # to generate single-byte lookup tables, or inline comparisons
40 ret.append((pos, e-1)) # append range tuple to list
47 # before a 256-byte lookup table is produced. If there are less than this
51 # dictionary of functions, key=name, element contains char-map and range-list
63 # The lines in the .def file have three types:-
77 # split line into space-separated fields, then split on type
95 print("name '%s' already present - may give" \
142 # split the range into it's first-val, last-val
160 # common path - 'currange' has the range, now take care of it
161 # We split on single-byte values vs. multibyte
162 if currange[1] < 0x100: # single-byte
169 else: # multi-byte
181 # enter the output phase, where we generate the two files chvalid.c and'
184 # To do this, we first output the 'static' data (heading, fixed
185 # definitions, etc.), then output the 'dynamic' data (the results
186 # of the above processing), and finally output closing 'static' data
200 output = open("chvalid.c", "w") variable
207 header.write(
265 output.write(
286 * single-byte character is within the specified group. Each table
295 # Now output the generated data.
298 # still not as fast as a sequence of inline compares. So, if the single-byte
299 # portion of a range has a "small" number of ranges, we output a macro for inline
300 # compares, otherwise we output a 256-byte table and a macro to use it.
307 # First we convert the specified single-byte values into a group of ranges.
315 header.write("XMLPUBVAR const unsigned char %s_tab[256];\n" % f)
316 header.write("""
324 header.write("#define %s_ch(c)\t(%s_tab[(c)])\n" % (f, f))
326 # write the constant data to the code file
327 output.write("const unsigned char %s_tab[256] = {\n" % f)
332 output.write(pline + "\n")
334 output.write(pline + " 0x%02x };\n\n" % Functs[f][0][255])
337 # first another little optimisation - if space is present,
346 header.write("""
354 # okay, I'm tired of the messy lineup - let's automate it!
357 ntab = 4 - (len(pline)) // 8
369 if rg[0] == rg[1]: # single value - check equal
379 header.write(pline)
381 header.write("""
390 ntab = 4 - (len(pline)) // 8
396 header.write(pline + just + "(((c) < 0x100) ? \\\n\t\t\t\t ")
398 header.write("%s_ch((c)) :" % f)
400 header.write("0 :")
405 header.write(" 0)\n\n")
408 header.write(" \\\n\t\t\t\t xmlCharInRange((c), &%sGroup))\n\n" % f)
417 if rg[0] == rg[1]: # single value - check equal
423 header.write(pline)
427 header.write("XMLPUBVAR const xmlChRangeGroup %sGroup;\n" % f)
448 output.write(pline + "\n")
456 output.write(pline + "};\n")
462 output.write(pline + "\n")
465 output.write(pline + "};\n") # finish off last group
477 output.write(pline + "};\n\n")
479 output.write(
499 \tif (rptr->nbShortRange == 0)
502 \thigh = rptr->nbShortRange - 1;
503 \tsptr = rptr->shortRange;
507 \t\thigh = mid - 1;
517 \tif (rptr->nbLongRange == 0) {
521 \thigh = rptr->nbLongRange - 1;
522 \tlptr = rptr->longRange;
526 \t\thigh = mid - 1;
545 output.write("""
553 output.write(" * Use %s_ch or %sQ instead" % (f, f))
555 output.write(" * Use %sQ instead" % f)
556 output.write("""
561 output.write("int\n%s(unsigned int ch) {\n return(%sQ(ch));\n}\n\n" % (f,f))
562 header.write("XMLPUBFUN int\n\t\t%s(unsigned int ch);\n" % f);
564 # Run complete - write trailers and close the output files
567 header.write("""
576 output.close()