tal.fig 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #### license: creative commons cc0 1.0 (public domain)
  2. #### http://creativecommons.org/publicdomain/zero/1.0/
  3. proginf = "tal 0.1, nov 2018 mn"
  4. function getsize p
  5. f split p " " mid 1 1
  6. try
  7. now f int
  8. except
  9. f 0
  10. resume
  11. now return f
  12. fig
  13. function gettype p
  14. fn split p "/" right 1 mid 1 1
  15. cdot instr fn "."
  16. iftrue cdot
  17. now split fn "." right 1 mid 1 1 reverse plus "." reverse return now
  18. else
  19. now return fn
  20. fig
  21. fig
  22. tal arr
  23. python
  24. tal = {}
  25. fig
  26. function taldo p t
  27. python
  28. global tal
  29. try: tal[p] = int(tal[p]) + t
  30. except: tal[p] = t
  31. fig
  32. fig
  33. now taldo "a" 1
  34. files arrstdin
  35. forin p files
  36. tab 9 chr
  37. ctab instr p tab
  38. csf instr p "/"
  39. iftrue ctab
  40. iftrue csf
  41. size getsize p
  42. filetype gettype p
  43. now taldo filetype size
  44. fig
  45. fig
  46. next
  47. talfig arr mid 0 1
  48. python
  49. for p in tal.keys():
  50. if int(tal[p]) > 32767: talfig += [(int(tal[p]), p)]
  51. talfig.sort()
  52. for p in talfig: print p[0], p[1]
  53. print
  54. fig