Source file: /~heha/hsn/esptool.zip/esptool.h

#pragma once
#include <windowsx.h>
#include <shlwapi.h>
#include <stdio.h>	// FILE*
#include "types.h"
#include "intrin.h"	// autostring

__declspec(noreturn) void vFatal(const char*,va_list);
__declspec(noreturn) void _cdecl Fatal(const char*,...);
__declspec(noreturn) void _cdecl Fatal(unsigned,...);
autostring loadString(unsigned);
void _cdecl printf(unsigned,...);
void _cdecl println(unsigned,...);
void _cdecl println(const char*,...);
void newline();
extern struct Console{
 byte x,y,w,h;	// eher: Terminal-Koordinaten
 void init();
}tty;


// Memory dump files must either have an address in front of the real file name,
// or the hexadecimal address as part of the file name.
// flag bits	input		output
// flags.0	0		1 = address in file name
// flags.1	0		1 = file length detected
// flags.2	0		1 = address given as prefix
// flags.3	0		1 = length given as prefix
// flags.4	0		1 = file is gzip compressed
class Dumpfile{
 const char*n;	// NOT owned by Dumpfile
 byte*d;	// owned by Dumpfile
 uint32 strlenp1(uint32) const;
protected:
 void parseFrontOfName();
public:
 uint32 addr,size,ucrc,usize;
 byte flags;
 Dumpfile(byte);			// von Ressource
 Dumpfile(byte*,uint32 s,uint32 a);	// von Parser, initialisiert mit Datenzeiger, Größe und Ladeadresse
 Dumpfile(const char*);			// von Datei, alles initialisiert, data owned
// Dumpfile(const Dumpfile&o) = delete;
// void operator=(const Dumpfile&o) = delete;
 ~Dumpfile();
 const char*name() const {return n;}
 byte*data() {return d;}
 const byte*data() const{return d;}
};

typedef bool (*cb2_t)(void*pObj,const Dumpfile&);

bool parseBinFile(const char*fname,cb2_t cb,void*cbd,uint32*sadr);

#pragma pack(2)	// avoid gap between port and baud
struct ComSel{
 POINTS pos;	// window position (top left)
 char showcmd;	// SW_SHOW etc.
 BYTE port;	// 0 means COM1, etc.
 DWORD baud;
 bool load();
 bool dialog(HWND=0);
 bool save();
 ComSel(BYTE p=2,DWORD b=115200);
 static HANDLE Open(UINT ComNr,DWORD dwFlags=0);	// ComNr=0 = COM1 usw.
 // returns 0 on failure, not INVALID_HANDLE_VALUE aka (HANDLE)-1
};
#pragma pack()

class LastBaud{
 uint32 baud;
 void load();
 void save();
public:
 LastBaud():baud(0) {load();}
// ~LastBaud() {save();}
 operator uint32() const {return baud;}
 void operator=(uint32 n) {baud=n; save();}
};
Detected encoding: ANSI (CP1252)4
Wrong umlauts? - Assume file is ANSI (CP1252) encoded