2 * Copyright 1996 Ulrich Schmid
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 const char *first_paragraph
;
36 const char *next_paragraph
;
37 const char *special_char
;
38 const char *begin_italic
;
39 const char *end_italic
;
40 const char *begin_boldface
;
41 const char *end_boldface
;
42 const char *begin_typewriter
;
43 const char *end_typewriter
;
56 "<!doctype linuxdoc system>\n"
80 CHARMAP_ENTRY charmap
[] =
178 /***********************************************************************
183 static void print_text(const char *p
)
189 for (i
= 0; charmap
[i
].ch
; i
++)
190 if (*p
== charmap
[i
].ch
)
192 printf(format
.special_char
, charmap
[i
].subst
);
200 /***********************************************************************
205 int main(int argc
, char **argv
)
209 HLPFILE_PARAGRAPH
*paragraph
;
214 hlpfile
= HLPFILE_ReadHlpFile(argc
> 1 ? argv
[1] : "");
216 if (!hlpfile
) return 2;
219 strftime(date
, sizeof(date
), "%x", localtime(&t
));
220 filename
= strrchr(hlpfile
->lpszPath
, '/');
221 if (filename
) filename
++;
222 else filename
= hlpfile
->lpszPath
;
225 printf(format
.header1
);
226 print_text(hlpfile
->lpszTitle
);
227 printf(format
.header2
, filename
, date
);
229 for (page
= hlpfile
->first_page
; page
; page
= page
->next
)
231 paragraph
= page
->first_paragraph
;
232 if (!paragraph
) continue;
235 printf(format
.section
);
236 for (; paragraph
&& !paragraph
->u
.text
.wVSpace
; paragraph
= paragraph
->next
)
237 print_text(paragraph
->u
.text
.lpszText
);
238 printf(format
.first_paragraph
);
240 for (; paragraph
; paragraph
= paragraph
->next
)
242 switch (paragraph
->cookie
)
244 case para_normal_text
:
245 case para_debug_text
:
246 /* New line; new paragraph */
247 if (paragraph
->u
.text
.wVSpace
== 1)
248 printf(format
.newline
);
249 else if (paragraph
->u
.text
.wVSpace
> 1)
250 printf(format
.next_paragraph
);
252 if (paragraph
->u
.text
.wFont
)
253 printf(format
.begin_boldface
);
255 print_text(paragraph
->u
.text
.lpszText
);
257 if (paragraph
->u
.text
.wFont
)
258 printf(format
.end_boldface
);
272 /***********************************************************************
274 * Substitutions for some WINELIB functions
277 static FILE *file
= 0;
279 HFILE WINAPI
OpenFile( LPCSTR path
, OFSTRUCT
*ofs
, UINT mode
)
281 file
= *path
? fopen(path
, "r") : stdin
;
282 return file
? (HFILE
)1 : HFILE_ERROR
;
285 HFILE WINAPI
_lclose( HFILE hFile
)
291 LONG WINAPI
_hread( HFILE hFile
, LPVOID buffer
, LONG count
)
293 return fread(buffer
, 1, count
, file
);
296 HANDLE WINAPI
GetProcessHeap(void)
301 void* WINAPI
HeapAlloc( HANDLE heap
, DWORD flags
, DWORD size
)
307 void* WINAPI
HeapReAlloc( HANDLE heap
, DWORD flags
, void* ptr
, DWORD size
)
310 return realloc(ptr
, size
);
313 BOOL WINAPI
HeapFree( HGLOBAL handle
, DWORD flags
, void* ptr
)
319 char __wine_dbch_winhelp
[] = "\003winhelp";
321 int wine_dbg_log( int cls
, const char *channel
, const char *func
, const char *format
, ... )
326 HBITMAP WINAPI
CreateDIBitmap(HDC hdc
, CONST BITMAPINFOHEADER
* bih
, DWORD a
, CONST
void* ptr
, CONST BITMAPINFO
* bi
, UINT c
)
331 HMETAFILE WINAPI
SetMetaFileBitsEx(UINT cbBuffer
, CONST BYTE
*lpbBuffer
)
336 BOOL WINAPI
DeleteMetaFile(HMETAFILE h
)
341 HDC WINAPI
GetDC(HWND h
)
346 int WINAPI
ReleaseDC(HWND h
, HDC hdc
)
351 BOOL WINAPI
DeleteObject(HGDIOBJ h
)
358 * Copyright 1993 Yngvi Sigurjonsson (yngvi@hafro.is)
361 INT WINAPI
lstrcmp( LPCSTR str1
, LPCSTR str2
)
363 return strcmp( str1
, str2
);
366 INT WINAPI
lstrcmpi( LPCSTR str1
, LPCSTR str2
)
372 if ((res
= toupper(*str1
) - toupper(*str2
)) != 0) return res
;
376 return toupper(*str1
) - toupper(*str2
);
379 INT WINAPI
lstrlen( LPCSTR str
)
384 LPSTR WINAPI
lstrcpyA( LPSTR dst
, LPCSTR src
)
386 if (!src
|| !dst
) return NULL
;