File: intrs_for_doc.py

package info (click to toggle)
llvm-py 0.6%2Bsvn105-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,060 kB
  • sloc: python: 3,844; ansic: 1,963; cpp: 508; pascal: 87; makefile: 9; sh: 1
file content (25 lines) | stat: -rwxr-xr-x 680 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python

import os

NCOLS = 4
INF   = '../llvm/_intrinsic_ids.py'
OUTF  = '../www/src/intrinsics.csv'

intrs = []
for line in file(INF):
    if line.startswith('INTR_'):
        if 'INTR_ALPHA_'  not in line and  \
           'INTR_ARM_'    not in line and  \
           'INTR_BFIN_'   not in line and  \
           'INTR_PPC_'    not in line and  \
           'INTR_SPU_'    not in line and  \
           'INTR_X86_'    not in line and  \
           'INTR_XCORE_'  not in line:
            intrs.append(line.split()[0])

outf = open(OUTF, 'wt')
i = 0
while i < len(intrs):
    print >>outf, "`" + "`,`".join(intrs[i:min(i+NCOLS,len(intrs)+1)]) + "`"
    i += NCOLS