trunk/src/build/file2str.py
| r244727 | r244728 | |
| 29 | 29 | print("Unable to open source file '%s'" % srcfile) |
| 30 | 30 | sys.exit(-1) |
| 31 | 31 | |
| 32 | | bytes = os.path.getsize(srcfile) |
| 32 | byteCount = os.path.getsize(srcfile) |
| 33 | 33 | try: |
| 34 | 34 | dst = open(dstfile,'w') |
| 35 | 35 | dst.write('extern const %s %s[];\n' % ( type, varname )); |
| r244727 | r244728 | |
| 42 | 42 | for b in chunk: |
| 43 | 43 | dst.write('0x%02x' % b) |
| 44 | 44 | offs = offs + 1 |
| 45 | | if offs != bytes: |
| 45 | if offs != byteCount: |
| 46 | 46 | dst.write(',') |
| 47 | 47 | else: |
| 48 | 48 | break |
| 49 | | if offs != bytes: |
| 49 | if offs != byteCount: |
| 50 | 50 | dst.write('\n\t') |
| 51 | 51 | if terminate == 1: |
| 52 | 52 | dst.write(',0x00') |