News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

win32-doc md files

Started by TimoVJL, May 18, 2025, 04:24:44 PM

Previous topic - Next topic

TimoVJL

https://github.com/MicrosoftDocs/win32
MS Win32 help files in md-format.

Test program just open zip-file and check all md-files for "api_name:" keywords.

At first might be better just to extract one folder and zip it again for testing.

One full test 58416 files.

Keyword test for keywordsint ParseFile(char *pMem, int nSize, char *szFile, int nLen, int nIdx)
{
char *pPtr, *pPtr1, *pPtr2;
pPtr = strstr(pMem, "api_name:"); // CRT
//pPtr = StrStr(pMem, "api_name:"); // shlwapi.dll
if (pPtr) {
printf("%s\t", szFile);
pPtr += 9; // pass
while (*pPtr != 10) pPtr++;
pPtr++;
pPtr1 = pPtr;
pPtr2 = pPtr;
//*(pPtr+10) = 0;
do {
while (*pPtr2 != 10) pPtr2++;
*pPtr2 = 0; // cut to newline
printf("%s ", pPtr1);
pPtr2++;
pPtr1 = pPtr2;
} while (*pPtr2 == '-');
printf("\n");
} else printf("%s\n", szFile);
return 0;
}
May the source be with you

John Z

Thanks TimoVJL,

Got it and the entire WIN32 zip.  Will let you know.

John Z

Quin

This is absolutely incredible, thanks Timo!
Use the assembly, Luke.

John Z

#3
Hi TimoVJL.

Here is a SQLITE3 database and some crude sample code to access it.  The DB3 file is 7Z inside of the project zip so it must be un7z'd into the application directory.  The DB contains the API NAMES your utility identified in the WIN32-docs.zip downloaded from GitHub. For each* API NAME it contains the path within the ZIP files needed to extract the .md file for the API so that the .md file can be viewed. A small dialog is used for the demo.

*This is just a first pass as the WIN32-Docs was not consistent in file naming, so there are some names it will not yet work on.  This can be handled if the project seems to be of value by making multiple queries for a given API name trying each of the various filename formats.

There is a readme in the project directory as well.

John Z

TimoVJL

A your example provide, that MS help file is just useless.

Last locally working help file is from 2019-09-05

After that, just pile of shi....
May the source be with you

John Z

Hi TimoVJL,

It is actually worse than you might think too.

HOWEVER -
I added a few code lines to your extract program and from the new extract I have built a new database, handling all identified API_NAME files.  So it accommodates the inconsistent formats, and other issues.

The GitHub documentation was clearly (to me) done by multiple people/groups with various inconsistencies and no general oversight.  Some API_NAMES are not even API functions, many files for the same base API Name bla bla bla...

So the new DB3 takes care of everything extracted by your extract program.

I'll create the new queries needed to output the filename to extract and show, next.  Where there are multiple files for the same base API NAME the user will need to select, similar to HINT when searching a partial function name.

Another possible use of the DB is to create a treeview where the top level are the directories and child level is for the API NAMEs... easy for user to see/browse for the API function they want information on, clicking a child level item pulls the file from the zip and displays it.
Depends on how much work is to be invested in the final output.

John Z

TimoVJL

Only good thing is, that now is possible to create database for online help.
You have done great job with that MS help material.
May the source be with you

John Z

#7
Hi TimoVJL,

Attached is the new DB for the GitHub win32-docs.zip offline documentation.  Every API_NAME output by your extract program is accessible in the DB.

Had some clean-up to do and I'm looking for 'runs the first time" bug in my C access program.

So posting the DB now.  Later posting my access program when bug free, but I'm sure it is not really needed by most people.  Because of the complexity/inconsistency of the win32-doc using a sql 'like' command will often be the first step in getting to the document desired.

Like the 1st db the "Win32-docs\\desktop-src\\" is to be pre-appended to the SQL returns, that is the DB returns the SubDir and the actual filename.md, as before.

John Z

John Z

Here is the newest mdfiles program and MD_Files_3.db3 to use with it.

This version outputs the win32-doc.zip path for every API NAME outputted when using TimoVJL's extract utility.  Note that due to GitHub documentation inconsistencies some API NAMES are not really API NAMES, but these are still handled in this db3.  For example entering /-o shows a list to pick for example /-out yielding a filename and path as
Win32-docs\desktop-src\Midl\-out.md 

This program just shows how to get the filename and path from the db3.  It does not extract the .md file to be displayed in a suitable .md file viewer or using webview.

The .db3 is compressed with zip inside of the project zip and needs to be uncompressed before using.  The db3 file of course can be used by anyone, for anything . . . . as can this program.

John Z

TimoVJL

#9
In Pelles C bin folder is SQLite3.dll
To create x64 SQLite3.lib
SET PATH=C:\Program Files\PellesC\bin
polib "%PATH%\SQLite3.dll" -out:SQLite3.lib
EDIT: processing .yml file can be used for external help system to open pages from MS site.
May the source be with you

John Z

Well - Here is the next version of the mdfiles program.
I had hoped I had dropped enough hints that one of the more experienced would have created this but seems left for me  8) so here it is.

With this version one downloads the entire ZIP from from GitHub as TimoVJL mentions at the top of this topic.  For the original mdfiles program I used TimoVJL's extract program to extract API Names from it, which I then used to created a database of the names and the paths within the github zip file.  It stopped there.

Now with this new version 2.0 of mdfiles.exe it will if desired extract the selected .md for you, into the application directory.  It also can just display the selected .md file without doing any extracting to the hard disk. Of course you can copy from the display too. See Screen shots -

There is a readme.txt in the zip file along with the .exe and the api db3 file.  No sources yet as I need to figure out using the new minizip - I'm using a very old crude 2 file zip implementation and not happy about it, but I made it work.... 

John Z

John Z

The next improvement to the mdfiles program -

This adds the ability to show the .md file as .html in the browser.
Also creates a temp subdirectory under the program directory for the
files created so that it is easy to delete ones no longer wanted.  All
.md files and .html file will go into the temp directory.

The .md to .html file is using MIT License and Copyright © 2016-2024 Martin Mitáš
(http://github.com/mity/md4c) with my mods to make it work in Pelles C.

The .html file will use the systems default program to handle .html extension files.
Was going to use Timo's webview - but maybe later.

The upload only includes the .exe and a readme so use the db files from the prior post.

Input welcome and wanted.

John Z

TimoVJL

#12
An interesting project.

To compile md4c.c, a change for it at line 100:47, && !__POCC__
    #elif defined _MSC_VER  &&  _MSC_VER > 120 && !__POCC__
May the source be with you

John Z

Yes about what I did but a bit differently-
I added     #ifdef _PELLESC__
        #define MD_ASSERT(cond)     do {} while(0)
        #define MD_UNREACHABLE()    do {} while(0)
    #elif
at the beginning of the block there.

Flags are set to accommodate the GitHub idiosyncrasies, but
will probably work ok for any .md file.  Use the 'Convert other .md File'
button.

Here is a quick update of the program
Fixed needing the TOP button so that is now removed.

Added ability to list every name in the DB by entering an *
Hoping this makes it easier to find something -

John Z

Still need to modernize the ZIP code before posting sources.

TimoVJL

#14
Many times is good to keep line numbers intact.

Have miniz still problems with Pelles C 13 ?

Like in this:
https://github.com/kuba--/zip

EDIT: it have :(
May the source be with you