File: bin2c

package info (click to toggle)
brandy 1.23.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,268 kB
  • sloc: ansic: 39,421; makefile: 91; sh: 1
file content (24 lines) | stat: -rwxr-xr-x 671 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
   10ON ERROR IF ERR=26 THEN GOTO 300 ELSE REPORT: PRINT " at line ";ERL:END
   20IF ARGC < 2 THEN GOTO 300
   30infile$=ARGV$(1)
   40outfile$=ARGV$(2)
   50i%=OPENIN(infile$)
   60o%=OPENOUT(outfile$)
   70l%=0
   80BPUT#o%,"const char _binary_app_start[] = { "
   90WHILE EOF#i%=0
  100  c%=BGET#i%
  110  BPUT#o%,STR$c%+",";
  120  l%+=1
  130ENDWHILE
  140PTR#o%=(PTR#o%-1)
  150BPUT#o%,""
  160BPUT#o%,"};"
  170BPUT#o%,"const int _binary_app_len="+STR$l%+";"
  180CLOSE#i%
  190CLOSE#o%
  200END
  300REM ARM BBC BASIC handler, also used if no CLI parameters given in Brandy
  310INPUT "Input filename >"infile$
  320INPUT "Output filename >"outfile$
  330GOTO 50