/[pcre]/code/trunk/maint/MultiStage2.py
ViewVC logotype

Diff of /code/trunk/maint/MultiStage2.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 352 by ph10, Mon Jul 7 15:12:56 2008 UTC revision 491 by ph10, Mon Mar 1 17:45:08 2010 UTC
# Line 26  Line 26 
26  #  Adjusted global table names by prefixing _pcre_.  #  Adjusted global table names by prefixing _pcre_.
27  #  Commented out stuff relating to the casefolding table, which isn't used.  #  Commented out stuff relating to the casefolding table, which isn't used.
28  #  Corrected size calculation  #  Corrected size calculation
29    #  Add #ifndef SUPPORT_UCP to use dummy tables when no UCP support is needed.
30  #  #
31  # The tables generated by this script are used by macros defined in  # The tables generated by this script are used by macros defined in
32  # pcre_internal.h. They look up Unicode character properties using short  # pcre_internal.h. They look up Unicode character properties using short
# Line 65  Line 66 
66  # individual character types such as ucp_Cc to the general types like ucp_C.  # individual character types such as ucp_Cc to the general types like ucp_C.
67  #  #
68  #  Philip Hazel, 03 July 2008  #  Philip Hazel, 03 July 2008
69    #
70    # 01-March-2010: Updated list of scripts for Unicode 5.2.0
71  ##############################################################################  ##############################################################################
72    
73    
# Line 101  def read_table(file_name, get_value, def Line 104  def read_table(file_name, get_value, def
104                  if len(chardata) <= 1:                  if len(chardata) <= 1:
105                          continue                          continue
106                  value = get_value(chardata)                  value = get_value(chardata)
   
107                  m = re.match(r'([0-9a-fA-F]+)(\.\.([0-9a-fA-F]+))?$', chardata[0])                  m = re.match(r'([0-9a-fA-F]+)(\.\.([0-9a-fA-F]+))?$', chardata[0])
108                  char = int(m.group(1), 16)                  char = int(m.group(1), 16)
109                  if m.group(3) is None:                  if m.group(3) is None:
# Line 245  script_names = ['Arabic', 'Armenian', 'B Line 247  script_names = ['Arabic', 'Armenian', 'B
247  # New for Unicode 5.0  # New for Unicode 5.0
248   'Balinese', 'Cuneiform', 'Nko', 'Phags_Pa', 'Phoenician', \   'Balinese', 'Cuneiform', 'Nko', 'Phags_Pa', 'Phoenician', \
249  # New for Unicode 5.1  # New for Unicode 5.1
250   'Carian', 'Cham', 'Kayah_Li', 'Lepcha', 'Lycian', 'Lydian', 'Ol_Chiki', 'Rejang', 'Saurashtra', 'Sundanese', 'Vai']   'Carian', 'Cham', 'Kayah_Li', 'Lepcha', 'Lycian', 'Lydian', 'Ol_Chiki', 'Rejang', 'Saurashtra', 'Sundanese', 'Vai', \
251    # New for Unicode 5.2
252     'Avestan', 'Bamum', 'Egyptian_Hieroglyphs', 'Imperial_Aramaic', \
253     'Inscriptional_Pahlavi', 'Inscriptional_Parthian', \
254     'Javanese', 'Kaithi', 'Lisu', 'Meetei_Mayek', \
255     'Old_South_Arabian', 'Old_Turkic', 'Samaritan', 'Tai_Tham', 'Tai_Viet'
256     ]
257    
258  category_names = ['Cc', 'Cf', 'Cn', 'Co', 'Cs', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu',  category_names = ['Cc', 'Cf', 'Cn', 'Co', 'Cs', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu',
259    'Mc', 'Me', 'Mn', 'Nd', 'Nl', 'No', 'Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps',    'Mc', 'Me', 'Mn', 'Nd', 'Nl', 'No', 'Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps',
# Line 276  for block_size in [2 ** i for i in range Line 284  for block_size in [2 ** i for i in range
284  print "#ifdef HAVE_CONFIG_H"  print "#ifdef HAVE_CONFIG_H"
285  print "#include \"config.h\""  print "#include \"config.h\""
286  print "#endif"  print "#endif"
287    print
288  print "#include \"pcre_internal.h\""  print "#include \"pcre_internal.h\""
289  print  print
290  print "/* Unicode character database. */"  print "/* Unicode character database. */"
291  print "/* This file was autogenerated by the MultiStage2.py script. */"  print "/* This file was autogenerated by the MultiStage2.py script. */"
292  print "/* Total size: %d bytes, block size: %d. */" % (min_size, min_block_size)  print "/* Total size: %d bytes, block size: %d. */" % (min_size, min_block_size)
293    print
294    print "/* The tables herein are needed only when UCP support is built */"
295    print "/* into PCRE. This module should not be referenced otherwise, so */"
296    print "/* it should not matter whether it is compiled or not. However */"
297    print "/* a comment was received about space saving - maybe the guy linked */"
298    print "/* all the modules rather than using a library - so we include a */"
299    print "/* condition to cut out the tables when not needed. But don't leave */"
300    print "/* a totally empty module because some compilers barf at that. */"
301    print "/* Instead, just supply small dummy tables. */"
302    print
303    print "#ifndef SUPPORT_UCP"
304    print "const ucd_record _pcre_ucd_records[] = {{0,0,0 }};"
305    print "const uschar _pcre_ucd_stage1[] = {0};"
306    print "const pcre_uint16 _pcre_ucd_stage2[] = {0};"
307    print "#else"
308    print
309  print record_struct  print record_struct
310  print_records(records, record_size)  print_records(records, record_size)
311  print_table(min_stage1, '_pcre_ucd_stage1')  print_table(min_stage1, '_pcre_ucd_stage1')
# Line 288  print_table(min_stage2, '_pcre_ucd_stage Line 313  print_table(min_stage2, '_pcre_ucd_stage
313  print "#if UCD_BLOCK_SIZE != %d" % min_block_size  print "#if UCD_BLOCK_SIZE != %d" % min_block_size
314  print "#error Please correct UCD_BLOCK_SIZE in pcre_internal.h"  print "#error Please correct UCD_BLOCK_SIZE in pcre_internal.h"
315  print "#endif"  print "#endif"
316    print "#endif  /* SUPPORT_UCP */"
317    
318  """  """
319    

Legend:
Removed from v.352  
changed lines
  Added in v.491

  ViewVC Help
Powered by ViewVC 1.1.5