ReactOS 0.4.16-dev-1946-g52006dd
utils.h File Reference
#include "widltypes.h"
#include "parser.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define error_loc(...)   error_at( NULL, ## __VA_ARGS__ )
 
#define warning_loc(...)   warning_at( NULL, ## __VA_ARGS__ )
 
#define MAKEVERSION(major, minor)   ((((minor) & 0xffff) << 16) | ((major) & 0xffff))
 
#define MAJORVERSION(version)   ((version) & 0xffff)
 
#define MINORVERSION(version)   (((version) >> 16) & 0xffff)
 

Functions

void error (const char *s,...) __attribute__((format(printf
 
void __attribute__ ((noreturn))
 
void error_at (const struct location *, const char *s,...) __attribute__((format(printf
 
void warning (const char *s,...) __attribute__((format(printf
 
void void warning_at (const struct location *, const char *s,...) __attribute__((format(printf
 
void chat (const char *s,...) __attribute__((format(printf
 
void size_t strappend (char **buf, size_t *len, size_t pos, const char *fmt,...) __attribute__((__format__(__printf__
 
void size_t size_t widl_getline (char **linep, size_t *lenp, FILE *fp)
 
void add_output_to_resources (const char *type, const char *name)
 
void flush_output_resources (const char *name)
 
void put_pword (unsigned int val)
 
void put_str (int indent, const char *format,...) __attribute__((format(printf
 

Macro Definition Documentation

◆ error_loc

#define error_loc (   ...)    error_at( NULL, ## __VA_ARGS__ )

Definition at line 29 of file utils.h.

◆ MAJORVERSION

#define MAJORVERSION (   version)    ((version) & 0xffff)

Definition at line 48 of file utils.h.

◆ MAKEVERSION

#define MAKEVERSION (   major,
  minor 
)    ((((minor) & 0xffff) << 16) | ((major) & 0xffff))

Definition at line 47 of file utils.h.

◆ MINORVERSION

#define MINORVERSION (   version)    (((version) >> 16) & 0xffff)

Definition at line 49 of file utils.h.

◆ warning_loc

#define warning_loc (   ...)    warning_at( NULL, ## __VA_ARGS__ )

Definition at line 32 of file utils.h.

Function Documentation

◆ __attribute__()

void __attribute__ ( (noreturn)  )

Definition at line 266 of file pseh3.c.

271{
272#ifdef __clang__
273 asm volatile (
274 /* Load the registers */
275 "movl 24(%%ecx), %%esp\n\t"
276 "movl 28(%%ecx), %%ebp\n\t"
277
278 "movl 36(%%ecx), %%ebx\n\t"
279 "movl 40(%%ecx), %%esi\n\t"
280 "movl 44(%%ecx), %%edi\n\t"
281
282 /* Stack pointer is 4 off from the call to __SEH3$_RegisterFrame */
283 "addl $4, %%esp\n\t"
284
285 /* Jump into the exception handler */
286 "jmp *%[Target]"
287 : :
288 "c" (RegistrationFrame),
289 "a" (RegistrationFrame->ScopeTable),
290 [Target] "m" (RegistrationFrame->ScopeTable->Target)
291 );
292#else
293 asm volatile (
294 /* Load the registers */
295 "movl 24(%%ecx), %%esp\n\t"
296 "movl 28(%%ecx), %%ebp\n\t"
297
298 /* Stack pointer is 4 off from the call to __SEH3$_RegisterFrame */
299 "addl $4, %%esp\n\t"
300
301 /* Jump into the exception handler */
302 "jmp *%[Target]"
303 : :
304 "c" (RegistrationFrame),
305 "a" (RegistrationFrame->ScopeTable),
306 [Target] "m" (RegistrationFrame->ScopeTable->Target)
307 );
308#endif
309
310 __builtin_unreachable();
311}
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

◆ add_output_to_resources()

void add_output_to_resources ( const char type,
const char name 
)

Definition at line 192 of file utils.c.

193{
194 size_t data_size = output_buffer_pos;
195 size_t header_size = 5 * sizeof(unsigned int) + 2 * sizeof(unsigned short);
196
198
199 if (type[0] != '#') header_size += (strlen( type ) + 1) * sizeof(unsigned short);
200 else header_size += 2 * sizeof(unsigned short);
201 if (name[0] != '#') header_size += (strlen( name ) + 1) * sizeof(unsigned short);
202 else header_size += 2 * sizeof(unsigned short);
203
204 header_size = (header_size + 3) & ~3;
205 align_output( 4 );
206 check_output_buffer_space( header_size );
207 resources[nb_resources].size = header_size + output_buffer_pos;
209
211 put_dword( data_size ); /* ResSize */
212 put_dword( header_size ); /* HeaderSize */
213 put_resource_id( type ); /* ResType */
214 put_resource_id( name ); /* ResName */
215 align_output( 4 );
216 put_dword( 0 ); /* DataVersion */
217 put_word( 0 ); /* Memory options */
218 put_word( 0 ); /* Language */
219 put_dword( 0 ); /* Version */
220 put_dword( 0 ); /* Characteristics */
221
224}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ARRAY_SIZE(A)
Definition: main.h:20
static void put_dword(struct bytecode_buffer *buffer, DWORD value)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define assert(x)
Definition: debug.h:53
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static void align_output(unsigned int align)
Definition: tools.h:833
static void init_output_buffer(void)
Definition: tools.h:791
static void check_output_buffer_space(size_t size)
Definition: tools.h:782
static void put_word(unsigned short val)
Definition: tools.h:811
size_t output_buffer_pos
Definition: utils.c:164
static struct resource resources[16]
static void put_resource_id(const char *str)
Definition: utils.c:174
static unsigned int nb_resources
Definition: utils.c:172
unsigned char * output_buffer
Definition: utils.c:163
Definition: name.c:39

Referenced by output_typelib_regscript(), save_all_changes(), and write_regscript().

◆ chat()

void chat ( const char s,
  ... 
)

◆ error()

void error ( const char s,
  ... 
)

◆ error_at()

void error_at ( const struct location ,
const char s,
  ... 
)

◆ flush_output_resources()

void flush_output_resources ( const char name)

Definition at line 226 of file utils.c.

227{
228 unsigned int i;
229
230 /* all output must have been saved with add_output_to_resources() first */
232
233 put_dword( 0 ); /* ResSize */
234 put_dword( 32 ); /* HeaderSize */
235 put_word( 0xffff ); /* ResType */
236 put_word( 0x0000 );
237 put_word( 0xffff ); /* ResName */
238 put_word( 0x0000 );
239 put_dword( 0 ); /* DataVersion */
240 put_word( 0 ); /* Memory options */
241 put_word( 0 ); /* Language */
242 put_dword( 0 ); /* Version */
243 put_dword( 0 ); /* Characteristics */
244
245 for (i = 0; i < nb_resources; i++)
246 {
248 free( resources[i].data );
249 }
251 nb_resources = 0;
252}
#define free
Definition: debug_ros.c:5
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HRESULT flush_output_buffer(mxwriter *This)
Definition: mxwriter.c:661
static void put_data(const void *data, size_t size)
Definition: tools.h:798

Referenced by save_all_changes(), write_regscript(), and write_typelib_regscript().

◆ put_pword()

void put_pword ( unsigned int  val)

Definition at line 255 of file utils.c.

256{
257 if (pointer_size == 8) put_qword( val );
258 else put_dword( val );
259}
GLuint GLfloat * val
Definition: glext.h:7180
static void put_qword(unsigned int val)
Definition: tools.h:827
unsigned int pointer_size
Definition: widl.c:147

◆ put_str()

void put_str ( int  indent,
const char format,
  ... 
)

◆ strappend()

void size_t strappend ( char **  buf,
size_t len,
size_t  pos,
const char fmt,
  ... 
)

◆ warning()

void warning ( const char s,
  ... 
)

◆ warning_at()

void void warning_at ( const struct location ,
const char s,
  ... 
)

◆ widl_getline()

void size_t size_t widl_getline ( char **  linep,
size_t lenp,
FILE fp 
)

Definition at line 91 of file utils.c.

92{
93 char *line = *linep;
94 size_t len = *lenp;
95 size_t n = 0;
96
97 if (!line)
98 {
99 len = 64;
100 line = xmalloc(len);
101 }
102
103 while (fgets(&line[n], len - n, fp))
104 {
105 n += strlen(&line[n]);
106 if (line[n - 1] == '\n')
107 break;
108 else if (n == len - 1)
109 {
110 len *= 2;
111 line = xrealloc(line, len);
112 }
113 }
114
115 *linep = line;
116 *lenp = len;
117 return n;
118}
void * xmalloc(int size)
Definition: uimain.c:747
void * xrealloc(void *oldmem, size_t size)
Definition: uimain.c:736
GLdouble n
Definition: glext.h:7729
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
Definition: parser.c:49

Referenced by write_dlldata().