Page 2 of 3

Re: C layer for KolibriOS. A GSoC project.

Posted: Wed May 25, 2016 3:27 pm
by ashmew2
I'm waiting for libimg wrappers :)

Netsurf needs it.

Go punk_joker!

Re: C layer for KolibriOS. A GSoC project.

Posted: Mon Jun 20, 2016 5:28 am
by punk_joker
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.

Re: C layer for KolibriOS. A GSoC project.

Posted: Mon Jun 20, 2016 7:13 am
by ashmew2
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.

Re: C layer for KolibriOS. A GSoC project.

Posted: Mon Jun 20, 2016 8:43 pm
by Albom
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.

Re: C layer for KolibriOS. A GSoC project.

Posted: Wed Jun 22, 2016 11:24 am
by Albom
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.

Re: C layer for KolibriOS. A GSoC project.

Posted: Fri Jun 24, 2016 12:10 pm
by punk_joker
I'll do tonight code refactoring, and I will consider the comments. Thank you.

Re: C layer for KolibriOS. A GSoC project.

Posted: Mon Jun 27, 2016 8:10 am
by punk_joker
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.

Re: C layer for KolibriOS. A GSoC project.

Posted: Thu Jun 30, 2016 5:12 pm
by punk_joker
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.

Re: C layer for KolibriOS. A GSoC project.

Posted: Wed Jul 06, 2016 1:19 pm
by Siemargl
Add --subsystem windows to LDFLAGS
This sets needed flag in header, which is checked in newlibc startup code.

Re: C layer for KolibriOS. A GSoC project.

Posted: Tue Jul 12, 2016 6:33 pm
by 0CodErr
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

Re: C layer for KolibriOS. A GSoC project.

Posted: Mon Jul 18, 2016 1:50 pm
by Albom
punk_joker
How is it going?

Re: C layer for KolibriOS. A GSoC project.

Posted: Fri Oct 21, 2016 12:50 pm
by Siemargl
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, чем к обвязке

Re: C layer for KolibriOS. A GSoC project.

Posted: Fri Oct 21, 2016 1:11 pm
by punk_joker
ColorDialog есть, он входит в proc_lib как и OpenDialog. А для него я писал обертку.

Re: C layer for KolibriOS. A GSoC project.

Posted: Fri Oct 21, 2016 6:38 pm
by Siemargl
punk_joker wrote:ColorDialog есть, он входит в proc_lib как и OpenDialog. А для него я писал обертку.
Обертка есть, демки пока нет (комментарий относится к **).

Соответственно, где есть демки - в каком то объеме проверена и работоспособность.

Re: C layer for KolibriOS. A GSoC project.

Posted: Fri Oct 21, 2016 8:38 pm
by punk_joker
По rasterworks демка у есть, хотя обертку надо доделать (сделать структуру буфера). Про баги писать в теме box_lib.