ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
1.5 KiB

  1. rem PUrpose: re-define externals to only 6 characters for CMS
  2. rem Author: Howard Wulf, AF5NE
  3. rem Date: 2015-02-10
  4. rem Usage: implementation defined
  5. rem Example:
  6. rem ~/bwbasic cms.bas
  7. rem
  8. let N = 0
  9. let E$ = "extern "
  10. let E = len( E$ )
  11. open "bwbasic.h" for input as #1
  12. open "cms.h" for output as #2
  13. while not eof( #1 )
  14. line input #1, L$
  15. L$ = trim$( L$ )
  16. if left$( L$, E ) = E$ then
  17. rem extern ....
  18. while instr( L$, ";" ) = 0
  19. ' read more text to get semicolon
  20. line input #1, M$
  21. M$ = trim$( M$ )
  22. L$ = L$ + " " + M$
  23. wend
  24. rem extern ...;
  25. L$ = trim$(mid$( L$, E + 1 ))
  26. ' truncate semicolon
  27. X = instr( L$, ";" )
  28. if X > 0 then
  29. L$ = trim$(left$( L$, X - 1 ))
  30. end if
  31. ' truncate parenthesis
  32. X = instr( L$, "(" )
  33. if X > 0 then
  34. L$ = trim$(left$( L$, X - 1 ))
  35. end if
  36. ' truncate bracket
  37. X = instr( L$, "[" )
  38. if X > 0 then
  39. L$ = trim$(left$( L$, X - 1 ))
  40. end if
  41. ' find last word
  42. X = instr(L$, " " )
  43. while X > 0
  44. L$ = trim$(mid$( L$, X + 1 ))
  45. X = instr(L$, " " )
  46. wend
  47. ' skip astericks
  48. while left$( L$, 1 ) = "*"
  49. L$ = trim$(mid$( L$, 2 ))
  50. wend
  51. if L$ = "main" then
  52. ' ignore
  53. else
  54. ' pad for alignment
  55. L$ = L$ + space$(32)
  56. L$ = left$( L$, 32 )
  57. H$ = "00000" + hex$(N)
  58. H$ = right$( H$, 5 )
  59. print #2, "#define ";L$;" X";H$
  60. N = N + 1
  61. end if
  62. end if
  63. wend
  64. close #2
  65. close #1
  66. end