News:

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

Main Menu

Recent posts

#31
Work in progress / Re: win32-doc md files
Last post by John Z - November 08, 2025, 02:09:03 PM
:)
It looks like I have got 3.0.2 working in Pelles C at least for unzipping to a file or memory.

I'll need to run some tests to see if it works for zipping too.

Making progress in either case.

John Z

Update - looking nice, it was able to zip a file and both 7z and WIN zip could access it and the file was extracted intact and readable.

#32
Assembly discussions / Re: Rich Edit sample
Last post by Vortex - November 08, 2025, 09:15:32 AM
Same example built with binary resource template :

include DlgBox.inc

.data

DialogBox:

INCBIN "MyDlg.bin"

.code

start:

    mov     eax,RichEditANSIWndProc
    invoke  GetModuleHandle,0

    xor     ecx,ecx
    invoke  DialogBoxIndirectParam,eax,\
            ADDR DialogBox,ecx,ADDR DlgProc,ecx

    invoke  ExitProcess,eax

DlgProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

    .IF uMsg==WM_CLOSE

        invoke  EndDialog,hWnd,0

    .ELSE

        xor     eax,eax
        ret

    .ENDIF

    mov     eax,1
    ret

DlgProc ENDP

END start
#33
Work in progress / Re: win32-doc md files
Last post by John Z - November 06, 2025, 11:22:03 PM
Quote from: TimoVJL on November 06, 2025, 07:06:38 PMLike in this:
https://github.com/kuba--/zip

Thank Timo!  I'll give this one a try - maybe simple enough for me to use.

John Z

Update:  An older version of this (1.19) is what I am using now.  Back in about 2020 I went through the 1.19 code and succeeded in getting it to work for Pelles C.  Now looking at this version 3.0.2 it is just as difficult under Pelles C as 1.19 was :( but structurally it has changed a lot so a file difference does not highlight changes compared to what I did in 1.19 SO it is basically going to be starting all over......   
#34
Work in progress / Re: win32-doc md files
Last post by Vortex - November 06, 2025, 07:14:31 PM
Hi Timo,

Mentioning about Miniz, are your referring to this project?

https://github.com/richgel999/miniz
#35
Work in progress / Re: win32-doc md files
Last post by TimoVJL - November 06, 2025, 07:06:38 PM
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 :(
#36
Work in progress / Re: win32-doc md files
Last post by John Z - November 06, 2025, 04:18:08 PM
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.
#37
Work in progress / Re: win32-doc md files
Last post by TimoVJL - November 06, 2025, 01:03:09 PM
An interesting project.

To compile md4c.c, a change for it at line 100:47, && !__POCC__
    #elif defined _MSC_VER  &&  _MSC_VER > 120 && !__POCC__
#38
Work in progress / Re: win32-doc md files
Last post by John Z - November 06, 2025, 12:07:12 PM
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
#39
Tips & tricks / Railgun_Doublet
Last post by TimoVJL - November 04, 2025, 12:55:43 PM
http://www.sanmayce.com/Railgun/index.html

An interesting function to replace strstr for special cases.
#include <stdlib.h>
#include <stdint.h>
// All Railgun variants are written by Georgi 'Kaze', they are free, however I expect the user to mention its homepage, that is: http://www.sanmayce.com/Railgun/index.html
// Author's email: sanmayce@sanmayce.com
// Caution: For better speed the case 'if (cbPattern==1)' was removed, so Pattern must be longer than 1 char.
char * Railgun_Doublet (char * pbTarget, char * pbPattern, uint32_t cbTarget, uint32_t cbPattern)
{
    char * pbTargetMax = pbTarget + cbTarget;
    register uint32_t ulHashPattern;
    uint32_t ulHashTarget, count, countSTATIC;

    if (cbPattern > cbTarget) return(NULL);

    countSTATIC = cbPattern-2;

    pbTarget = pbTarget+cbPattern;
    ulHashPattern = (*(uint16_t *)(pbPattern));

    for ( ;; ) {
        if ( ulHashPattern == (*(uint16_t *)(pbTarget-cbPattern)) ) {
            count = countSTATIC;
            while ( count && *(char *)(pbPattern+2+(countSTATIC-count)) == *(char *)(pbTarget-cbPattern+2+(countSTATIC-count)) ) {
                count--;
            }
            if ( count == 0 ) return((pbTarget-cbPattern));
        }
        pbTarget++;
        if (pbTarget > pbTargetMax) return(NULL);
    }
}