C layer for KolibriOS. A GSoC project.

High-level languages programming questions
  • Wrapped for libini, while only the most used functions. In LIBINI_enum_sections and LIBINI_enum_keys, there is a problem, the program crashes after the first section, or key, that is, the next section is not transferred.
    to infinity and beyond
  • punk_joker wrote:Wrapped for libini, while only the most used functions. In LIBINI_enum_sections and LIBINI_enum_keys, there is a problem, the program crashes after the first section, or key, that is, the next section is not transferred.
    Make sure the alignment is correct . When I was writing the wrappers, i,faced some issues like this.
    Also be careful with stacks becoming unbalanced after function calls etc

    I think also the location of the imports was leading to an error in some wrapper. I added a comment to the relevant wrapper or assembly file, please check,them for reference.
    ---
    Check out the Netsurf Web Browser for KolibriOS.
    Read the wiki and happy hacking with KolibriOS!
  • punk_joker wrote:Wrapped for libini, while only the most used functions. In LIBINI_enum_sections and LIBINI_enum_keys, there is a problem, the program crashes after the first section, or key, that is, the next section is not transferred.
    Please write some tests. And it is necessary to define what should functions return? Now, it is 0 on success and mixture of -1 and 1 in other case. Btw dll.Load returns 1 on unsuccess.
  • punk_joker

    You can simplify the code.

    For example, in kolibri_buf2d.h:

    Code: Select all

      int asm_init_status = init_buf2d_asm();
     
      /* just return asm_init_status? or return init_boxlib_asm() ?*/
     
      if(asm_init_status == 0)
        return 0;
      else
        return 1;
    You really can use returned value of init_buf2d_asm:
    return init_buf2d_asm();
    And in loadbuf2d.asm:

    Code: Select all

            
            stdcall dll.Load, @IMPORT
            test    eax, eax
            jnz     error
           
            mov eax, 0
            ret
           
    error: 
            mov eax, -1
            ret
    It is possible to write such code as:

    Code: Select all

    stdcall dll.Load, @IMPORT
    test    eax, eax
    jz     ok
    xor eax, eax
    dec eax
    ok: 
    ret
    
    if you want to return -1 on failure.
    Or

    Code: Select all

    stdcall dll.Load, @IMPORT
    ret
    
    if you want to return 1 on failure.

    And it would be good style if 'SUCCESS' and 'FAILURE' constants were defined.
  • I'll do tonight code refactoring, and I will consider the comments. Thank you.
    to infinity and beyond
  • Regarding example. I have not yet figured out completely from the assembly organization, and therefore preempted example with the necessary files that duplicate existing in the SVN. In the near future I will correct it.
    to infinity and beyond
  • In the attached file, the new version of the project organization. Folder Test in arhiae, to extract /сontrib.

    From the current problems with the compilation of example via makefiles, when the program starts in KolibriOS starts and a console window.
    Attachments
    test.7z (12.57 KiB)
    Downloaded 410 times
    to infinity and beyond
  • Add --subsystem windows to LDFLAGS
    This sets needed flag in header, which is checked in newlibc startup code.
  • I found in loadboxlib.asm the following lines:
    http://websvn.kolibrios.org/filedetails ... sm#line-37

    Code: Select all

    editbox_key:
            mov [oldebp], ebp       ;Save ebp because GCC is crazy for it otherwise.
            pop ebp                 ;Save return address in ebp. Stack top is param now.
            mov eax, dword [press_key]
            call [edit_box_key]     ; The pointer we passed should be on the stack already.
            push ebp                ;push the return address back to stack
            mov ebp, [oldebp]
            ret
            
    oldebp dd ?
    press_key dd ?
    What if more than one thread will use this code?

    I paid attention to it because the situation is similar to the situation with my progressbar(this was fixed already) viewtopic.php?f=24&t=1220&start=270#p52844
  • punk_joker
    How is it going?
  • punk_joker wrote:A detailed plan for the first half:

    25 may - new project structure, example programm and makefile
    27 may - final work on box_lib
    29 may - wrapper for kmenu
    2 june - wrapper for libimg (you need to deal with some issues)
    5 june - libini, libio
    9 june - archive
    11 june - rasterworks
    13 june - libgfx
    15 june - buf2d
    17 june - xml
    18 june - libcrash
    18 - 20 june - inspection checking, correcting possible errors
    Статус на сегодня, в связи с окончанием обвязки box_lib. Цифра в списке - пункт из даты сверху
    Пометки: + выполнено, ** - есть примеры, - нет
    • 25 +
    • 27 + ** (кроме colordialog)
    • 29 + **
    • 2 + **
    • 5 + (libio не нужна, все есть в libc)
    • 9 -
    • 11 +
    • 13 +
    • 15 +
    • 17 -
    • 18 -
    • http -(незаконч)
    • msgbox + **
    Нужно еще задокументировать и рефакторить, но это в процессе применения.

    Есть конечно и баги - вот по ним вопрос - куда бы их писать и отслеживать. Они (в моем ведении) больше относятся к box_lib, чем к обвязке
  • ColorDialog есть, он входит в proc_lib как и OpenDialog. А для него я писал обертку.
    to infinity and beyond
  • punk_joker wrote:ColorDialog есть, он входит в proc_lib как и OpenDialog. А для него я писал обертку.
    Обертка есть, демки пока нет (комментарий относится к **).

    Соответственно, где есть демки - в каком то объеме проверена и работоспособность.
  • По rasterworks демка у есть, хотя обертку надо доделать (сделать структуру буфера). Про баги писать в теме box_lib.
    to infinity and beyond
  • Who is online

    Users browsing this forum: No registered users and 0 guests