Re: Object-oriented preprocessor

new topic     » goto parent     » topic index » view thread      » older message » newer message
jmduro said...

Now I will adapt the demo\win32 examples of OEU. This will be in another thread when available and could be a basis for a new win32lib_r2.oex.

As the preprocessor leaves translated files in place, users will have to versions available: OOP style and translated version.

The preprocessor has still a lot of bugs but the translated version of the windows demo works. It is available here: http://jean-marc.duro.pagesperso-orange.fr/window_demo.zip

I don't see the benefits of programming in such a way. It has roughly the same number of lines of code than the original.

Maybe if the whole win32lib replacement was written it could be different. Than, the demo would be:

include new_win32lib.ew 
include classes.e 
 
-- callback routine to handle Window class 
function WndProc(atom hwnd, atom iMsg, atom wParam, atom lParam) 
  atom  
    wav_file = allocate_string(getenv("windir")&`\Media\tada.wav`), 
    Euphoria = allocate_string("A Plain Vanilla Window using Euphoria!"), 
    ps = allocate(64), 
    rect = allocate(16)  
 
  if iMsg = WM_CREATE then 
    c_proc(PlaySound, {wav_file, 
           NULL, 
           or_bits(SND_FILENAME, SND_ASYNC)}) 
    return 0 
 
  elsif iMsg = WM_PAINT then 
    atom hdc = c_func(BeginPaint, {hwnd, ps}) 
    c_proc(GetClientRect, {hwnd, rect}) 
    c_proc(DrawText, {hdc, Euphoria, -1, rect,  
          or_all({DT_SINGLELINE, DT_CENTER, DT_VCENTER})}) 
    c_proc(EndPaint, {hwnd, ps}) 
    return 0 
 
  elsif iMsg = WM_DESTROY then 
    c_proc(PostQuitMessage, {0}) 
    return 0 
   
  end if 
   
  return c_func(DefWindowProc, {hwnd, iMsg, wParam, lParam}) 
end function 
 
integer mainWin = classes:new("mainWin", TWindow) 
callMethod(mainWin, "create", {"MLE Test", 0, 0, 0, 300, 300, 0, routine_id("WndProc")}) 
 
WinMain() 

It is such a tremendous work that it will probably not be achieved.

Jean-Marc

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu