News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#41
Expert questions / Re: _readdir() translates some...
Last post by TimoVJL - August 23, 2026, 02:08:45 PM
Function fopen might be a problem too, as it works with ANSI filenames.
I did some tests, even i don't like those functions, as i rather use Win32 API.
#42
Expert questions / _readdir() translates some non...
Last post by RobertSteed - August 23, 2026, 11:19:49 AM
Dear forum,
My code includes the following:
#include <dirent.h>
#include <locale.h>
...
setlocale(LC_ALL, "");
...
_DIR *dir;
struct _dirent *dirent;
dir = _opendir(path); // Open the folder
...
dirent = _readdir(dir); // Read first entry in folder // Read first entry in folder
if (dirent == NULL)
{ perror(path);
return 1;
}
while (dirent != NULL) // While not at end of folder
{
printf("dirent->d_name = %s\n", dirent->d_name);
...

Which results in
dirent->d_name = Art of Beksinski 1978 (MHS) (2).jpgLater code tries to open the files found:
FILE *fh = fopen(fn, "rb");which of course results in an error message:
Couldn't open test data\Art of Beksinski 1978 (MHS) (2).jpg: No such file or directoryThe actual filename is "Art of Beksiński 1978 (MHS) (2).jpg" with a diacritic on the "n". _readdir() worked as expected for "00tést.jpg" which has a diacritic on the "e".
So how can I get _opendir to return all non-ASCII file names as they are, without translating some characters?
#43
Assembly discussions / Find characters inside a strin...
Last post by Vortex - August 20, 2026, 09:18:26 PM
FindChar function to find characters inside strings :

.386
.model flat,stdcall
option casemap:none

ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG

.data

mystr   db 'This is a test.',0
f1      db 'Address of the string = %X',13,10
        db 'Address of the character a = %X',0

.code

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

FindChar PROC src:DWORD,char:DWORD

    mov     eax,DWORD PTR [esp+4]
    mov     ecx,DWORD PTR [esp+8]
    dec     eax
@@:
    inc     eax
    mov     dl,BYTE PTR [eax]
    test    dl,dl
    setz    dh
    xor     dl,cl
    setz    ch
    or      ch,dh
    jz      @b
    retn    8

FindChar ENDP

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef

start:

    invoke  FindChar,ADDR mystr,'a'
    invoke  printf,ADDR f1,ADDR mystr,eax

    invoke  ExitProcess,0

END start
#44
Assembly discussions / WriteFileToDisc function
Last post by Vortex - August 18, 2026, 08:16:05 PM
Simple function to write binary data to disc, 64-bit version :

include fileIO.inc

; Exit codes returned by WriteFileToDisc

; INVALID_HANDLE_VALUE equ -1 ; CreateFile API error
  WRITEFILE_ERROR      equ 0  ; WriteFile API error
  WRITEFILEDISC_OK     equ 1  ; Operation successfull

.code

WriteFileToDisc PROC pFileName:QWORD,pMemory:QWORD,nSize:QWORD PARMAREA=7*SIZEOF QWORD

;       pFileName       :   pointer to the file name
;       pMemory         :   address of the data block to write to disc
;       nSize           :   number of bytes to write

LOCAL hFile:QWORD
LOCAL BytesWritten:QWORD
LOCAL ExitCode:QWORD
LOCAL _pMemory:QWORD
LOCAL _nSize:QWORD


    mov     _pMemory,rdx
    mov     _nSize,r8
 
    invoke  CreateFile,pFileName,GENERIC_WRITE,0,0,\
            CREATE_ALWAYS,0,0

    cmp     eax,INVALID_HANDLE_VALUE
    je      _exitB
   
    mov     hFile,rax
    mov     rcx,rax
    mov     ExitCode,WRITEFILE_ERROR

    lea     r9,BytesWritten
    invoke  WriteFile,rcx,_pMemory,_nSize,r9,0
    test    rax,rax
    jz     _exitA
   
    mov     ExitCode,WRITEFILEDISC_OK

_exitA:
 
    invoke  CloseHandle,hFile
    mov     rax,ExitCode

_exitB:

    ret

WriteFileToDisc ENDP

END
#45
Work in progress / Re: Pelles C in russian
Last post by John Z - August 17, 2026, 02:37:25 AM
Hi,

Sorry, by "doing translations professionally" I meant as part of a job, career, contracted work, or a business.  Then the cost of the software would not be a personal purchase.

Regards,
John Z
#46
Work in progress / Re: Pelles C in russian
Last post by Dadatel - August 17, 2026, 01:16:00 AM
Quote from: John Z on August 16, 2026, 09:45:08 PM
Quote from: rubidus on August 15, 2026, 05:51:56 PMHi — same situation here. I'm working on a Korean (rsrc0012.dll, ko-KR) translation of the Pelles C IDE language pack and the compiler help.

If you are doing these translations professionally you might look at CHM EDITOR PRO, it purports to be able to edit .chm files intact with all html code untouched WYSIWYG and invisible much like an RTF editor. It also claims in line translation capability using a Google API. A bit pricey for a private individual perhaps, so I've not yet acquired it. I would like to though  :)

There is another thread or two about converting to Chinese which might have some tips, forum member ander_cc for example here: https://forum.pellesc.de/index.php?topic=11776.msg42219#msg42219

John Z

hallo
well if by professionally you mean automatically then i would rather do everything by hand, im not a nativ english user but i can speak in it freely and understand it(or i will really try to automize it idk if i will become lazy)

tank u
#47
Work in progress / Re: Pelles C in russian
Last post by John Z - August 16, 2026, 09:45:08 PM
Quote from: rubidus on August 15, 2026, 05:51:56 PMHi — same situation here. I'm working on a Korean (rsrc0012.dll, ko-KR) translation of the Pelles C IDE language pack and the compiler help.

If you are doing these translations professionally you might look at CHM EDITOR PRO, it purports to be able to edit .chm files intact with all html code untouched WYSIWYG and invisible much like an RTF editor. It also claims in line translation capability using a Google API. A bit pricey for a private individual perhaps, so I've not yet acquired it. I would like to though  :)

There is another thread or two about converting to Chinese which might have some tips, forum member ander_cc for example here: https://forum.pellesc.de/index.php?topic=11776.msg42219#msg42219

John Z
#48
Work in progress / Re: Pelles C in russian
Last post by Dadatel - August 16, 2026, 03:26:04 AM
well i don't know but resource hacker works(but there's a lot of strings from what you've said( ) but i will try da things that you've said

thanks
#49
Work in progress / Re: Pelles C in russian
Last post by rubidus - August 15, 2026, 05:51:56 PM
Hi — same situation here. I'm working on a Korean (rsrc0012.dll, ko-KR) translation of the Pelles C IDE language pack and the compiler help. I've finished a first pass of both, and what's left is review. I don't want to publish anything without Pelle's permission, though, so I sent him a forum PM(personal message) a while back. No reply yet, and he doesn't seem to log in often, so I expect he's just busy.

Does anyone know a better way to reach him — a preferred email address, or a board he follows more closely? I'd rather wait for his answer than release anything without it.

Just to be clear, this isn't a request for help — the DLL and the CHM both work on my side; the only open question is Pelle's, and it's entirely his to answer whenever he has time.

[Edit] Since this thread is about translating Pelles C, here are notes from doing the Korean one. Some of these cost us real time.

--- LANGUAGE PACK (the DLL) ---

The number in rsrc00NN is the Windows primary language ID in hex: English is LANG_ENGLISH 0x09, hence rsrc0009. Korean is 0x12, so ours is rsrc0012; Russian is 0x19, so yours would be rsrc0019. Set LANGUAGE LANG_RUSSIAN,SUBLANG_DEFAULT in the .rc, rename eng.* to your prefix, and retarget the references in the .ppj and .ppx. Leave ids.h alone.

Don't hand-edit the .rc. Extract every quoted string together with its line and column span, translate in a table, and substitute back mechanically. The file is UTF-16LE with BOM and the line structure has to survive; a spreadsheet round trip is far safer than editing 2,800 strings in place.

Then verify mechanically, on every string:
 - format specifiers (%d, %ls) — same ones, same order
 - escapes (\t, \n)
 - the accelerator & — same count, and no duplicates inside one dialog
 - file filters like "Include file (*.h)|*.h|" — the | structure and patterns
 - trailing colons, ellipses, and shortcut suffixes such as \tCtrl+X
We run this over all 2,834 strings; it catches things the eye slides past.

Watch for the same English string needing different translations in different dialogs — and the reverse. We shipped "Command line arguments:" translated two different ways in two dialogs before a check caught it. Keep the resource name and control symbol next to every string so you can tell them apart.

Finally, translated labels are usually longer than the English, and dialog controls are fixed size, so plan on checking dialogs in the IDE for clipping.

--- HELP FILE (the CHM) ---

chmls extracts, chmcmd compiles; both come with Free Pascal and script well. Microsoft's HTML Help Workshop also works.

Before translating anything, prove you can put it back: extract, reassemble unchanged, and compare byte for byte with the original. If that fails, whatever you translate afterwards sits on sand.

Cut at paragraphs, not at HTML text nodes. Our first attempt translated each text node separately, so "The <b>strcpy</b> function copies <i>src</i>." arrived as five fragments with no context, and nothing rescues that. Take the paragraph as one unit and turn inline markup into numbered placeholders, e.g. "The <g1>strcpy</g1> function copies <g2>src</g2>." — the translator keeps the count and numbering but may move them, which matters when word order differs.

Counting placeholders will not catch everything: we had one paragraph where <g1>string2</g1> came back as <g1>string1</g1>, so the wcsstr page described the wrong argument. Compare identifiers between source and translation separately.

Encoding: pages declare windows-1252. Rewrite the meta charset to your codepage and set Language= in the .hhp to match — the contents tree and the search index depend on it.

In the .hhp, don't list .hhc/.hhk under [FILES] if you already name them with Contents file= / Index file=; ours ended up stored twice. And compare your archive's internals against the original with `chmls list` before shipping.

Deduplicate: 61,793 paragraph blocks, but only 29,779 distinct. Translating each unique string once saved about 18% and made the result consistent.

Do the DLL first if you're doing both. The help names menu items constantly, and those names must read exactly as they do in your translated IDE. We found 157 places where the help had invented its own wording — correct translations, but not what the screen said.

One last thing: a finished CHM that opens blank or seems to hang is usually Windows' mark-of-the-web, not a bad build. Properties, then Unblock.
#50
Work in progress / Re: Pelles C in russian
Last post by Dadatel - August 14, 2026, 10:55:53 PM
well im already translating it(well if this dll is da pack or i will just fuck everything up), but still thank you
may the source be with you ;D