Beispiel #1
0
  if o == "-h":
    print __doc__
    sys.exit(2)
  elif o == "-o":
    output_file = a
  else:
    print >> sys.stderr, "unhandled option %s" % (o,)
    sys.exit(1)

if len(args) != 2:
  print "need exactly two input files, not %d" % (len(args),)
  print __doc__
  sys.exit(1)

fn = args[0]
tagfile = event_log_tags.TagFile(fn)

# Load the merged tag file (which should have numbers assigned for all
# tags.  Use the numbers from the merged file to fill in any missing
# numbers from the input file.
merged_fn = args[1]
merged_tagfile = event_log_tags.TagFile(merged_fn)
merged_by_name = dict([(t.tagname, t) for t in merged_tagfile.tags])
for t in tagfile.tags:
  if t.tagnum is None:
    if t.tagname in merged_by_name:
      t.tagnum = merged_by_name[t.tagname].tagnum
    else:
      # We're building something that's not being included in the
      # product, so its tags don't appear in the merged file.  Assign
      # them all an arbitrary number so we can emit the java and
Beispiel #2
0
# Restrictions on tags:
#
#   Tag names must be unique.  (If the tag number and description are
#   also the same, a warning is issued instead of an error.)
#
#   Explicit tag numbers must be unique.  (If the tag name is also the
#   same, no error is issued because the above rule will issue a
#   warning or error.)

by_tagname = {}
by_tagnum = {}

pre_merged_tags = {}
if pre_merged_file:
  for t in event_log_tags.TagFile(pre_merged_file).tags:
    pre_merged_tags[t.tagname] = t

for fn in args:
  tagfile = event_log_tags.TagFile(fn)

  for t in tagfile.tags:
    tagnum = t.tagnum
    tagname = t.tagname
    description = t.description

    if t.tagname in by_tagname:
      orig = by_tagname[t.tagname]

      # Allow an explicit tag number to define an implicit tag number
      if orig.tagnum is None:
        sys.exit(1)

# Restrictions on tags:
#
#   Tag names must be unique.  (If the tag number and description are
#   also the same, a warning is issued instead of an error.)
#
#   Explicit tag numbers must be unique.  (If the tag name is also the
#   same, no error is issued because the above rule will issue a
#   warning or error.)

by_tagname = {}
by_tagnum = {}

for fn in args:
    tagfile = event_log_tags.TagFile(fn)

    for t in tagfile.tags:
        tagnum = t.tagnum
        tagname = t.tagname
        description = t.description

        if t.tagname in by_tagname:
            orig = by_tagname[t.tagname]

            # Allow an explicit tag number to define an implicit tag number
            if orig.tagnum is None:
                orig.tagnum = t.tagnum
            elif t.tagnum is None:
                t.tagnum = orig.tagnum