clang-parse.nut 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. dofile("libclang.nut");
  2. local file_list_lib = [==[
  3. src/tbox/tbox.c
  4. src/tbox/math/math.c
  5. src/tbox/math/impl/random_linear.c
  6. src/tbox/math/int32.c
  7. src/tbox/math/fixed16.c
  8. src/tbox/math/random.c
  9. src/tbox/libc/libc.c
  10. src/tbox/libc/misc/time/mktime.c
  11. src/tbox/libc/misc/time/localtime.c
  12. src/tbox/libc/misc/time/gmmktime.c
  13. src/tbox/libc/misc/time/gmtime.c
  14. src/tbox/libc/misc/time/time.c
  15. src/tbox/libc/stdio/vswprintf.c
  16. src/tbox/libc/stdio/printf_object.c
  17. src/tbox/libc/stdio/swprintf.c
  18. src/tbox/libc/stdio/wprintf.c
  19. src/tbox/libc/stdio/puts.c
  20. src/tbox/libc/stdio/snprintf.c
  21. src/tbox/libc/stdio/wputs.c
  22. src/tbox/libc/stdio/printf.c
  23. src/tbox/libc/stdio/sprintf.c
  24. src/tbox/libc/stdio/vsnprintf.c
  25. src/tbox/libc/stdlib/wcstombs.c
  26. src/tbox/libc/stdlib/stdlib.c
  27. src/tbox/libc/stdlib/mbstowcs.c
  28. src/tbox/libc/stdlib/random.c
  29. src/tbox/libc/string/strrstr.c
  30. src/tbox/libc/string/strnrstr.c
  31. src/tbox/libc/string/memcpy.c
  32. src/tbox/libc/string/wcsndup.c
  33. src/tbox/libc/string/wcslen.c
  34. src/tbox/libc/string/wcscat.c
  35. src/tbox/libc/string/wcsirstr.c
  36. src/tbox/libc/string/strnstr.c
  37. src/tbox/libc/string/strcat.c
  38. src/tbox/libc/string/memdup.c
  39. src/tbox/libc/string/strnirstr.c
  40. src/tbox/libc/string/wcsnrchr.c
  41. src/tbox/libc/string/strnirchr.c
  42. src/tbox/libc/string/strcpy.c
  43. src/tbox/libc/string/strchr.c
  44. src/tbox/libc/string/strnlen.c
  45. src/tbox/libc/string/strlcpy.c
  46. src/tbox/libc/string/stricmp.c
  47. src/tbox/libc/string/strirchr.c
  48. src/tbox/libc/string/strncat.c
  49. src/tbox/libc/string/strncmp.c
  50. src/tbox/libc/string/strncpy.c
  51. src/tbox/libc/string/strdup.c
  52. src/tbox/libc/string/strirstr.c
  53. src/tbox/libc/string/wcsnicmp.c
  54. src/tbox/libc/string/wcsicmp.c
  55. src/tbox/libc/string/memmov.c
  56. src/tbox/libc/string/wcsncpy.c
  57. src/tbox/libc/string/wcsnirchr.c
  58. src/tbox/libc/string/wcslcpy.c
  59. src/tbox/libc/string/wcsnrstr.c
  60. src/tbox/libc/string/wcsichr.c
  61. src/tbox/libc/string/strndup.c
  62. src/tbox/libc/string/memmem.c
  63. src/tbox/libc/string/strstr.c
  64. src/tbox/libc/string/wcscmp.c
  65. src/tbox/libc/string/strnrchr.c
  66. src/tbox/libc/string/wcsirchr.c
  67. src/tbox/libc/string/strcmp.c
  68. src/tbox/libc/string/wcsrchr.c
  69. src/tbox/libc/string/wcschr.c
  70. src/tbox/libc/string/wcsrstr.c
  71. src/tbox/libc/string/wcsncmp.c
  72. src/tbox/libc/string/wcsdup.c
  73. src/tbox/libc/string/strrchr.c
  74. src/tbox/libc/string/wcsistr.c
  75. src/tbox/libc/string/strichr.c
  76. src/tbox/libc/string/wcsstr.c
  77. src/tbox/libc/string/stristr.c
  78. src/tbox/libc/string/wcsncat.c
  79. src/tbox/libc/string/memset.c
  80. src/tbox/libc/string/strlen.c
  81. src/tbox/libc/string/strnistr.c
  82. src/tbox/libc/string/wcsnlen.c
  83. src/tbox/libc/string/strnicmp.c
  84. src/tbox/libc/string/wcsnirstr.c
  85. src/tbox/libc/string/wcscpy.c
  86. src/tbox/libc/string/memcmp.c
  87. src/tbox/utils/crc.c
  88. src/tbox/utils/sha.c
  89. src/tbox/utils/adler32.c
  90. src/tbox/utils/trace.c
  91. src/tbox/utils/base64.c
  92. src/tbox/utils/singleton.c
  93. src/tbox/utils/used.c
  94. src/tbox/utils/lock_profiler.c
  95. src/tbox/utils/dump.c
  96. src/tbox/utils/base32.c
  97. src/tbox/utils/bits.c
  98. src/tbox/utils/md5.c
  99. src/tbox/utils/url.c
  100. src/tbox/prefix/state.c
  101. src/tbox/memory/native_allocator.c
  102. src/tbox/memory/default_allocator.c
  103. src/tbox/memory/queue_buffer.c
  104. src/tbox/memory/allocator.c
  105. src/tbox/memory/static_buffer.c
  106. src/tbox/memory/static_allocator.c
  107. src/tbox/memory/string_pool.c
  108. src/tbox/memory/impl/prefix.c
  109. src/tbox/memory/impl/static_fixed_pool.c
  110. src/tbox/memory/impl/static_large_allocator.c
  111. src/tbox/memory/impl/native_large_allocator.c
  112. src/tbox/memory/memory.c
  113. src/tbox/memory/fixed_pool.c
  114. src/tbox/memory/large_allocator.c
  115. src/tbox/memory/small_allocator.c
  116. src/tbox/memory/buffer.c
  117. src/tbox/string/static_string.c
  118. src/tbox/string/string.c
  119. src/tbox/stream/transfer.c
  120. src/tbox/stream/impl/filter/cache.c
  121. src/tbox/stream/impl/stream/filter.c
  122. src/tbox/stream/impl/stream/file.c
  123. src/tbox/stream/impl/stream/data.c
  124. src/tbox/stream/filter.c
  125. src/tbox/stream/stream.c
  126. src/tbox/stream/static_stream.c
  127. src/tbox/algorithm/heap_sort.c
  128. src/tbox/algorithm/count.c
  129. src/tbox/algorithm/predicate.c
  130. src/tbox/algorithm/remove_first_if.c
  131. src/tbox/algorithm/insert_sort.c
  132. src/tbox/algorithm/quick_sort.c
  133. src/tbox/algorithm/sort.c
  134. src/tbox/algorithm/count_if.c
  135. src/tbox/algorithm/rfind_if.c
  136. src/tbox/algorithm/binary_find.c
  137. src/tbox/algorithm/walk.c
  138. src/tbox/algorithm/bubble_sort.c
  139. src/tbox/algorithm/remove_if.c
  140. src/tbox/algorithm/remove.c
  141. src/tbox/algorithm/rwalk.c
  142. src/tbox/algorithm/remove_first.c
  143. src/tbox/algorithm/distance.c
  144. src/tbox/algorithm/binary_find_if.c
  145. src/tbox/algorithm/find_if.c
  146. src/tbox/algorithm/rfind.c
  147. src/tbox/algorithm/find.c
  148. src/tbox/container/list_entry.c
  149. src/tbox/container/heap.c
  150. src/tbox/container/vector.c
  151. src/tbox/container/bloom_filter.c
  152. src/tbox/container/iterator.c
  153. src/tbox/container/single_list.c
  154. src/tbox/container/queue.c
  155. src/tbox/container/stack.c
  156. src/tbox/container/hash_map.c
  157. src/tbox/container/list.c
  158. src/tbox/container/single_list_entry.c
  159. src/tbox/container/circle_queue.c
  160. src/tbox/container/element/long.c
  161. src/tbox/container/element/ptr.c
  162. src/tbox/container/element/str.c
  163. src/tbox/container/element/size.c
  164. src/tbox/container/element/true.c
  165. src/tbox/container/element/obj.c
  166. src/tbox/container/element/mem.c
  167. src/tbox/container/element/uint8.c
  168. src/tbox/container/element/uint16.c
  169. src/tbox/container/element/uint32.c
  170. src/tbox/container/element/null.c
  171. src/tbox/container/element/hash.c
  172. src/tbox/container/hash_set.c
  173. src/tbox/container/priority_queue.c
  174. src/tbox/container/iterator/long.c
  175. src/tbox/container/iterator/ptr.c
  176. src/tbox/container/iterator/str.c
  177. src/tbox/container/iterator/size.c
  178. src/tbox/container/iterator/mem.c
  179. src/tbox/libm/libm.c
  180. src/tbox/libm/idivi8.c
  181. src/tbox/libm/ilog2i.c
  182. src/tbox/libm/isqrti.c
  183. src/tbox/libm/isqrti64.c
  184. src/tbox/platform/directory.c
  185. src/tbox/platform/path.c
  186. src/tbox/platform/print.c
  187. src/tbox/platform/dynamic.c
  188. src/tbox/platform/atomic64.c
  189. src/tbox/platform/time.c
  190. src/tbox/platform/sched.c
  191. src/tbox/platform/processor.c
  192. src/tbox/platform/process.c
  193. src/tbox/platform/memory.c
  194. src/tbox/platform/backtrace.c
  195. src/tbox/platform/hostname.c
  196. src/tbox/platform/cache_time.c
  197. src/tbox/platform/file.c
  198. src/tbox/platform/page.c
  199. src/tbox/platform/platform.c
  200. src/tbox/platform/ifaddrs.c
  201. src/tbox/platform/environment.c
  202. src/tbox/libm/tan.c
  203. src/tbox/libm/sinf.c
  204. src/tbox/libm/exp1f.c
  205. src/tbox/libm/atanf.c
  206. src/tbox/libm/isfin.c
  207. src/tbox/libm/fmod.c
  208. src/tbox/libm/isinf.c
  209. src/tbox/libm/exp1.c
  210. src/tbox/libm/sqrtf.c
  211. src/tbox/libm/atan2.c
  212. src/tbox/libm/tanf.c
  213. src/tbox/libm/acos.c
  214. src/tbox/libm/pow.c
  215. src/tbox/libm/sincos.c
  216. src/tbox/libm/expf.c
  217. src/tbox/libm/sqrt.c
  218. src/tbox/libm/cosf.c
  219. src/tbox/libm/exp.c
  220. src/tbox/libm/isnan.c
  221. src/tbox/libm/sin.c
  222. src/tbox/libm/asin.c
  223. src/tbox/libm/isinff.c
  224. src/tbox/libm/isnanf.c
  225. src/tbox/libm/sincosf.c
  226. src/tbox/libm/expif.c
  227. src/tbox/libm/isfinf.c
  228. src/tbox/libm/asinf.c
  229. src/tbox/libm/fmodf.c
  230. src/tbox/libm/log2.c
  231. src/tbox/libm/expi.c
  232. src/tbox/libm/atan2f.c
  233. src/tbox/libm/cos.c
  234. src/tbox/libm/powf.c
  235. src/tbox/libm/atan.c
  236. src/tbox/libm/log2f.c
  237. src/tbox/libm/acosf.c
  238. src/tbox/xml/reader.c
  239. src/tbox/xml/node.c
  240. src/tbox/xml/writer.c
  241. src/tbox/regex/regex.c
  242. src/tbox/asio/aioo.c
  243. src/tbox/asio/aiop.c
  244. src/tbox/platform/dns.c
  245. src/tbox/platform/aioo.c
  246. src/tbox/platform/aiop.c
  247. src/tbox/platform/socket.c
  248. src/tbox/stream/impl/stream/http.c
  249. src/tbox/stream/impl/stream/sock.c
  250. src/tbox/stream/impl/filter/chunked.c
  251. src/tbox/network/ipv4.c
  252. src/tbox/network/ipv6.c
  253. src/tbox/network/dns/looker.c
  254. src/tbox/network/dns/cache.c
  255. src/tbox/network/dns/server.c
  256. src/tbox/network/cookies.c
  257. src/tbox/network/http.c
  258. src/tbox/network/hwaddr.c
  259. src/tbox/network/impl/http/method.c
  260. src/tbox/network/impl/http/option.c
  261. src/tbox/network/impl/http/status.c
  262. src/tbox/network/impl/http/date.c
  263. src/tbox/network/network.c
  264. src/tbox/network/ipaddr.c
  265. src/tbox/network/url.c
  266. src/tbox/asio/aico.c
  267. src/tbox/asio/aicp.c
  268. src/tbox/asio/http.c
  269. src/tbox/asio/dns.c
  270. src/tbox/stream/async_stream.c
  271. src/tbox/stream/impl/async_stream/prefix.c
  272. src/tbox/stream/impl/async_stream/http.c
  273. src/tbox/stream/impl/async_stream/sock.c
  274. src/tbox/stream/impl/async_stream/filter.c
  275. src/tbox/stream/impl/async_stream/file.c
  276. src/tbox/stream/impl/async_stream/data.c
  277. src/tbox/stream/async_transfer.c
  278. src/tbox/stream/transfer_pool.c
  279. src/tbox/platform/aicp.c
  280. src/tbox/asio/ssl.c
  281. src/tbox/platform/thread_pool.c
  282. src/tbox/platform/thread_store.c
  283. src/tbox/platform/thread.c
  284. src/tbox/platform/event.c
  285. src/tbox/platform/mutex.c
  286. src/tbox/platform/semaphore.c
  287. src/tbox/platform/timer.c
  288. src/tbox/platform/ltimer.c
  289. src/tbox/object/number.c
  290. src/tbox/object/boolean.c
  291. src/tbox/object/dictionary.c
  292. src/tbox/object/impl/reader/bplist.c
  293. src/tbox/object/impl/reader/bin.c
  294. src/tbox/object/impl/reader/reader.c
  295. src/tbox/object/impl/reader/json.c
  296. src/tbox/object/impl/writer/bplist.c
  297. src/tbox/object/impl/writer/bin.c
  298. src/tbox/object/impl/writer/json.c
  299. src/tbox/object/impl/writer/writer.c
  300. src/tbox/object/array.c
  301. src/tbox/object/null.c
  302. src/tbox/object/string.c
  303. src/tbox/object/data.c
  304. src/tbox/object/date.c
  305. src/tbox/object/object.c
  306. src/tbox/utils/option.c
  307. src/tbox/object/impl/reader/xml.c
  308. src/tbox/object/impl/reader/xplist.c
  309. src/tbox/object/impl/writer/xml.c
  310. src/tbox/object/impl/writer/xplist.c
  311. src/tbox/charset/charset.c
  312. src/tbox/charset/utf32.c
  313. src/tbox/charset/ascii.c
  314. src/tbox/charset/utf16.c
  315. src/tbox/charset/utf8.c
  316. src/tbox/charset/gb2312.c
  317. src/tbox/charset/ucs2.c
  318. src/tbox/charset/ucs4.c
  319. src/tbox/charset/iso8859.c
  320. src/tbox/stream/impl/filter/charset.c
  321. src/tbox/zip/zip.c
  322. src/tbox/stream/impl/filter/zip.c
  323. src/tbox/zip/gzip.c
  324. src/tbox/zip/zlib.c
  325. src/tbox/zip/zlibraw.c
  326. src/tbox/database/value.c
  327. src/tbox/database/sql.c
  328. src/tbox/database/impl/sqlite3.c
  329. src/tbox/network/impl/ssl/polarssl.c
  330. ]==];
  331. local file_list_demo = [==[
  332. src/demo/demo.c
  333. src/demo/libc/stdlib.c
  334. src/demo/libc/wchar.c
  335. src/demo/libc/time.c
  336. src/demo/libc/string.c
  337. src/demo/libm/integer.c
  338. src/demo/math/random.c
  339. src/demo/utils/crc.c
  340. src/demo/utils/sha.c
  341. src/demo/utils/adler32.c
  342. src/demo/utils/base64.c
  343. src/demo/utils/dump.c
  344. src/demo/utils/base32.c
  345. src/demo/utils/bits.c
  346. src/demo/utils/md5.c
  347. src/demo/utils/url.c
  348. src/demo/other/test.c
  349. src/demo/string/static_string.c
  350. src/demo/string/string.c
  351. src/demo/memory/memops.c
  352. src/demo/memory/default_allocator.c
  353. src/demo/memory/queue_buffer.c
  354. src/demo/memory/static_buffer.c
  355. src/demo/memory/large_pool.c
  356. src/demo/memory/string_pool.c
  357. src/demo/memory/impl/static_fixed_pool.c
  358. src/demo/memory/fixed_pool.c
  359. src/demo/memory/check.c
  360. src/demo/memory/small_allocator.c
  361. src/demo/memory/buffer.c
  362. src/demo/platform/barrier.c
  363. src/demo/platform/directory.c
  364. src/demo/platform/path.c
  365. src/demo/platform/utils.c
  366. src/demo/platform/atomic64.c
  367. src/demo/platform/processor.c
  368. src/demo/platform/process.c
  369. src/demo/platform/backtrace.c
  370. src/demo/platform/atomic.c
  371. src/demo/platform/hostname.c
  372. src/demo/platform/cache_time.c
  373. src/demo/platform/file.c
  374. src/demo/platform/ifaddrs.c
  375. src/demo/platform/environment.c
  376. src/demo/container/list_entry.c
  377. src/demo/container/heap.c
  378. src/demo/container/vector.c
  379. src/demo/container/bloom_filter.c
  380. src/demo/container/single_list.c
  381. src/demo/container/queue.c
  382. src/demo/container/stack.c
  383. src/demo/container/hash_map.c
  384. src/demo/container/list.c
  385. src/demo/container/single_list_entry.c
  386. src/demo/container/circle_queue.c
  387. src/demo/container/hash_set.c
  388. src/demo/algorithm/sort.c
  389. src/demo/algorithm/find.c
  390. src/demo/stream/stream.c
  391. src/demo/stream/stream/charset.c
  392. src/demo/stream/stream/zip.c
  393. src/demo/stream/stream/cache.c
  394. src/demo/stream/stream/null.c
  395. src/demo/math/fixed.c
  396. src/demo/libm/float.c
  397. src/demo/libm/double.c
  398. src/demo/platform/thread_pool.c
  399. src/demo/platform/thread_store.c
  400. src/demo/platform/event.c
  401. src/demo/platform/lock.c
  402. src/demo/platform/timer.c
  403. src/demo/platform/ltimer.c
  404. src/demo/platform/exception.c
  405. src/demo/platform/semaphore.c
  406. src/demo/xml/document.c
  407. src/demo/xml/reader.c
  408. src/demo/xml/writer.c
  409. src/demo/regex/regex.c
  410. src/demo/network/ipv4.c
  411. src/demo/network/ipv6.c
  412. src/demo/network/cookies.c
  413. src/demo/network/http.c
  414. src/demo/network/hwaddr.c
  415. src/demo/network/impl/date.c
  416. src/demo/network/ipaddr.c
  417. src/demo/network/spider.c
  418. src/demo/network/whois.c
  419. src/demo/network/url.c
  420. src/demo/network/dns.c
  421. src/demo/asio/aicpc.c
  422. src/demo/asio/http.c
  423. src/demo/asio/aiopd.c
  424. src/demo/asio/httpd.c
  425. src/demo/asio/aicpd.c
  426. src/demo/asio/dns.c
  427. src/demo/asio/aiopc.c
  428. src/demo/stream/async_stream.c
  429. src/demo/stream/transfer_pool.c
  430. src/demo/stream/async_transfer.c
  431. src/demo/stream/async_stream/charset.c
  432. src/demo/stream/async_stream/zip.c
  433. src/demo/stream/async_stream/cache.c
  434. src/demo/stream/async_stream/null.c
  435. src/demo/utils/option.c
  436. src/demo/object/bplist.c
  437. src/demo/object/xplist.c
  438. src/demo/object/bin.c
  439. src/demo/object/jcat.c
  440. src/demo/object/xml.c
  441. src/demo/object/dump.c
  442. src/demo/object/json.c
  443. src/demo/other/charset.c
  444. src/demo/database/sql.c
  445. ]==];
  446. local cflags_lib = "-c -Wno-error=deprecated-declarations -fno-strict-aliasing -g -Wall -Werror -O0 -std=c99 -Ibuild -Ibuild/tbox -D_GNU_SOURCE=1 -D_REENTRANT -D__tb_prefix__=\"tbox\" -Ipkg/zlib.pkg/inc/linux -Ipkg/zlib.pkg/inc -Ipkg/sqlite3.pkg/inc/linux -Ipkg/sqlite3.pkg/inc -Ipkg/openssl.pkg/inc/linux -Ipkg/openssl.pkg/inc -Ipkg/polarssl.pkg/inc/linux -Ipkg/polarssl.pkg/inc -Ipkg/pcre2.pkg/inc/linux -Ipkg/pcre2.pkg/inc -DPCRE2_CODE_UNIT_WIDTH=8 -Ipkg/pcre.pkg/inc/linux -Ipkg/pcre.pkg/inc -m64 -I/usr/include -I/usr/local/include"
  447. local cflags_demo = "-c -Wno-error=deprecated-declarations -fno-strict-aliasing -g -Wall -Werror -O0 -std=c99 -Ibuild -Ibuild/tbox -D_GNU_SOURCE=1 -D_REENTRANT -D__tb_prefix__=\"demo\" -Ipkg/zlib.pkg/inc/linux -Ipkg/zlib.pkg/inc -Ipkg/sqlite3.pkg/inc/linux -Ipkg/sqlite3.pkg/inc -Ipkg/pcre.pkg/inc/linux -Ipkg/pcre.pkg/inc -Ipkg/pcre2.pkg/inc/linux -Ipkg/pcre2.pkg/inc -DPCRE2_CODE_UNIT_WIDTH=8 -Ipkg/openssl.pkg/inc/linux -Ipkg/openssl.pkg/inc -Ipkg/polarssl.pkg/inc/linux -Ipkg/polarssl.pkg/inc -m64 -I/usr/include -I/usr/local/include"
  448. //libclangParse2sqlite("c2sqlite.db", "c2sqlite.c", "-I.", "-I/home/mingo/local/clang-3.6/include");
  449. function parseFileList(file_list, cflags)
  450. {
  451. local call_args = cflags.split(' ');
  452. call_args.insert(0, "");
  453. call_args.insert(0, "tbox-clang.db");
  454. call_args.insert(0, getroottable());
  455. foreach(fn in file_list.split('\n'))
  456. {
  457. if(fn && fn.len())
  458. {
  459. print("Now parsing:", fn);
  460. call_args[2] = fn;
  461. libclangParse2sqlite.acall(call_args);
  462. }
  463. }
  464. }
  465. parseFileList(file_list_lib, cflags_lib);
  466. parseFileList(file_list_demo, cflags_demo);