Source

libgxim / utils / type2pos.rb

Full commit
a = [		"\0",
                "SeparatorofNestedList\0",
		"CARD8\0",
		"CARD16\0",
		"CARD32\0",
		"STRING8\0",
		"Window\0",
		"XIMStyles\0",
		"XRectangle\0",
		"XPoint\0",
		"XFontSet\0",
		"XIMHotKeyTriggers\0",
		"XIMHotKeyState\0",
		"XIMStringConversion\0",
		"XIMPreeditState\0",
		"XIMResetState\0",
		"NestedList\0",
		"<Invalid>\0",
		"Padding\0",
		"AutoPadding\0",
		"n-bytes-marker[CARD8]\0",
		"n-bytes-marker[CARD16]\0",
		"n-bytes-marker[CARD32]\0",
		"n-items-marker[CARD16]\0",
		"STR\0",
		"GString\0",
		"GXimPreeditCaret\0",
		"GXimPreeditDraw\0",
		"GdkEvent\0",
                "GXimText\0",
                "GXimHotkeyTrigger\0",
                "Pixmap\0",
                "GXimStatusDraw\0",
		"LISTofXIMATTR\0",
		"LISTofXICATTR\0",
		"LISTofXIMATTRIBUTE\0",
		"LISTofXICATTRIBUTE\0",
		"LISTofEXT\0",
		"LISTofSTRING\0",
		"LISTofSTR\0",
		"LISTofENCODINGINFO\0",
                "LISTofBYTE\0",
		"LISTofCARD16\0",
                "LISTofXIMTRIGGERKEY\0"
]
c = 0
r = []
re = []
r << c
a.each do |i|
  c += i.length
  re << c
  r << c
end
p r
p re
l = a.join
re << l.length
(0..(r.length-1)).each do |i|
  p l.slice(r[i], re[i] - r[i])
end