comparison fuhtark_test/include/winapi/parser.h @ 1500:91c8c3b7cbf0

add: futhark tests for generating vulkan api
author sam <sam@basx.dev>
date Wed, 26 Nov 2025 21:36:48 +0700
parents
children
comparison
equal deleted inserted replaced
1499:1f58458b7ef7 1500:91c8c3b7cbf0
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #ifndef _PARSER_H
7 #define _PARSER_H
8
9 #include <stdio.h>
10
11 #undef CLASS_IMPORT_EXPORT
12 #ifdef HHCTRL
13 #define CLASS_IMPORT_EXPORT
14 #else
15 #define CLASS_IMPORT_EXPORT __declspec(dllimport)
16 #endif
17
18 #define PARSER_API_INLINE
19 #define MAX_LINE_LEN 1024
20
21 #define F_OK 0
22 #define F_NOFILE 1
23 #define F_READ 2
24 #define F_WRITE 3
25 #define F_MEMORY 4
26 #define F_EOF 5
27 #define F_END 6
28 #define F_TAGMISSMATCH 7
29 #define F_MISSINGENDTAG 8
30 #define F_NOTFOUND 9
31 #define F_NOPARENT 10
32 #define F_NULL 11
33 #define F_NOTITLE 12
34 #define F_LOCATION 13
35 #define F_REFERENCED 14
36 #define F_DUPLICATE 15
37 #define F_DELETE 16
38 #define F_CLOSE 17
39 #define F_EXISTCHECK 19
40
41 class CParseXML {
42 private:
43 CHAR m_cCurToken[MAX_LINE_LEN];
44 CHAR m_cCurWord[MAX_LINE_LEN];
45 CHAR m_cCurBuffer[MAX_LINE_LEN];
46 FILE *m_fh;
47 CHAR *m_pCurrentIndex;
48 DWORD m_dwError;
49 private:
50 DWORD Read();
51 DWORD SetError(DWORD dw) { m_dwError = dw; return m_dwError; }
52 public:
53 CParseXML() {
54 m_fh = NULL;
55 m_cCurBuffer[0] = '\0';
56 m_pCurrentIndex = NULL;
57 m_dwError = F_OK;
58 }
59 ~CParseXML() {
60 End();
61 }
62 CHAR *GetFirstWord(CHAR *);
63 CHAR *GetValue(CHAR *);
64 DWORD Start(const CHAR *szFile);
65 void End();
66 CHAR *GetToken();
67 DWORD GetError() { return m_dwError; }
68 };
69
70 typedef struct fifo {
71 CHAR *string;
72 fifo *prev;
73 } FIFO;
74
75 class CLASS_IMPORT_EXPORT CFIFOString {
76 private:
77 FIFO *m_fifoTail;
78 public:
79 CFIFOString() { m_fifoTail = NULL; }
80 ~CFIFOString();
81 void RemoveAll();
82 DWORD AddTail(CHAR *sz);
83 DWORD GetTail(CHAR **sz);
84 };
85 #endif