libc.obj: Updated samples.

git-svn-id: svn://kolibrios.org@9553 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2022-01-01 16:37:00 +00:00
parent 1eff55fdee
commit 0428045f25
9 changed files with 102 additions and 69 deletions

View File

@ -1,41 +1,40 @@
KTCC=kos32-tcc
KTCC=../../bin/kos32-tcc
FASM= fasm
KPACK = kpack
CFLAGS = -I../include -I../../../../../../contrib/sdk/sources/SDL-1.2.2_newlib/include
LDFLAGS = -nostdlib -L../../bin/lib ../../bin/lib/crt0.o
BIN= stdio_test.kex \
basic_gui.kex \
http_tcp_demo.kex \
math_test.kex \
string_test.kex \
whois.kex \
file_io.kex \
tmpdisk_work.kex \
consoleio.kex \
assert_test.kex \
fasm/sprintf_test.kex \
clayer/rasterworks.kex \
clayer/libimg.kex \
clayer/dialog.kex \
clayer/msgbox.kex \
clayer/boxlib.kex \
thread_work.kex \
sdltest.kex \
shell_test.kex \
libc_test.kex
LIBS= -lSDL -lshell -ltcc -lsound -ldialog -lrasterworks -limg -lbox -lmsgbox -lnetwork -lc.obj
LIBS = -lbox_lib -lshell -lSDL -lsound -lnetwork -lrasterworks -limg -ldialog -lmsgbox
BIN = stdio_test.kex \
basic_gui.kex \
http_tcp_demo.kex \
math_test.kex \
string_test.kex \
whois.kex \
file_io.kex \
tmpdisk_work.kex \
consoleio.kex \
assert_test.kex \
clayer/rasterworks.kex \
clayer/libimg.kex \
clayer/dialog.kex \
clayer/msgbox.kex \
clayer/boxlib.kex \
thread_work.kex \
sdltest.kex \
shell_test.kex \
libc_test.kex \
defgen.kex
all: $(BIN)
%.kex : %.c
$(KTCC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
$(KPACK) --nologo $@
%.kex : %.asm
-%.kex : %.asm
$(FASM) $< $@
$(KPACK) --nologo $@
clean:
rm *.kex clayer/*.kex

View File

@ -1,24 +1,24 @@
#SHS
mkdir /tmp0/1/tcc_samples
../tcc file_io.c -o /tmp0/1/tcc_samples/file_io -lc.obj
../tcc whois.c -o /tmp0/1/tcc_samples/whois -ltcc -lnetwork -lc.obj
../tcc stdio_test.c -o /tmp0/1/tcc_samples/stdio_test -lc.obj
../tcc basic_gui.c -o /tmp0/1/tcc_samples/basic_gui -ltcc -lc.obj
../tcc consoleio.c -o /tmp0/1/tcc_samples/consoleio -lc.obj
../tcc dir_example.c -o /tmp0/1/tcc_samples/ls_dir -lc.obj
../tcc http_tcp_demo.c -o /tmp0/1/tcc_samples/http_tcp_demo -ltcc -lnetwork -lc.obj
../tcc math_test.c -o /tmp0/1/tcc_samples/math_test -ltcc -lc.obj
../tcc string_test.c -o /tmp0/1/tcc_samples/string_test -ltcc -lc.obj
../tcc tmpdisk_work.c -o /tmp0/1/tcc_samples/tmpdisk_work -ltcc -lc.obj
../tcc clayer/boxlib.c -o /tmp0/1/tcc_samples/boxlib -ltcc -lbox -lc.obj
../tcc clayer/dialog.c -o /tmp0/1/tcc_samples/dialog -ltcc -ldialog -lc.obj
../tcc file_io.c -o /tmp0/1/tcc_samples/file_io
../tcc whois.c -o /tmp0/1/tcc_samples/whois -lnetwork
../tcc stdio_test.c -o /tmp0/1/tcc_samples/stdio_test
../tcc basic_gui.c -o /tmp0/1/tcc_samples/basic_gui
../tcc consoleio.c -o /tmp0/1/tcc_samples/consoleio
../tcc dir_example.c -o /tmp0/1/tcc_samples/ls_dir
../tcc http_tcp_demo.c -o /tmp0/1/tcc_samples/http_tcp_demo -lnetwork
../tcc math_test.c -o /tmp0/1/tcc_samples/math_test
../tcc string_test.c -o /tmp0/1/tcc_samples/string_test
../tcc tmpdisk_work.c -o /tmp0/1/tcc_samples/tmpdisk_work
../tcc clayer/boxlib.c -o /tmp0/1/tcc_samples/boxlib -lbox_lib
../tcc clayer/dialog.c -o /tmp0/1/tcc_samples/dialog -ldialog
cp clayer/logo.png /tmp0/1/tcc_samples/logo.png
../tcc clayer/libimg.c -o /tmp0/1/tcc_samples/libimg -ltcc -limg -lc.obj
../tcc clayer/msgbox.c -o /tmp0/1/tcc_samples/msgbox -ltcc -lmsgbox -lc.obj
../tcc clayer/rasterworks.c -o /tmp0/1/tcc_samples/rasterworks -ltcc -lrasterworks -lc.obj
../tcc thread_work.c -o /tmp0/1/tcc_samples/thread_work -ltcc -lc.obj
../tcc -I../include/SDL sdltest.c -o /tmp0/1/tcc_samples/sdltest -lSDL -lsound -ltcc -lc.obj
../tcc shell_test.c -o /tmp0/1/tcc_samples/shell_test -lshell -ltcc -lc.obj
../tcc libc_test.c -o /tmp0/1/tcc_samples/libc_test -ltcc -lc.obj
../tcc clayer/libimg.c -o /tmp0/1/tcc_samples/libimg -limg
../tcc clayer/msgbox.c -o /tmp0/1/tcc_samples/msgbox -lmsgbox
../tcc clayer/rasterworks.c -o /tmp0/1/tcc_samples/rasterworks -lrasterworks
../tcc thread_work.c -o /tmp0/1/tcc_samples/thread_work -ltcc -lc
../tcc -I../include/SDL sdltest.c -o /tmp0/1/tcc_samples/sdltest -lSDL -lsound
../tcc shell_test.c -o /tmp0/1/tcc_samples/shell_test -lshell
../tcc libc_test.c -o /tmp0/1/tcc_samples/libc_test
"/sys/File managers/Eolite" /tmp0/1/tcc_samples
exit

View File

@ -42,10 +42,8 @@ void draw_window(){
_ksys_end_draw();
}
int main()
{
kolibri_boxlib_init();
init_checkbox2(&output_off);
_ksys_set_event_mask(KSYS_EVM_REDRAW + KSYS_EVM_KEY + KSYS_EVM_BUTTON + KSYS_EVM_MOUSE+ KSYS_EVM_MOUSE_FILTER);
while(1){
@ -55,7 +53,7 @@ int main()
break;
case KSYS_EVENT_KEY:
edit_box_key(&ed, _ksys_get_key().val);
edit_box_key_safe(&ed, _ksys_get_key());
draw_window();
break;
@ -89,4 +87,4 @@ int main()
}
}
return 0;
}
}

View File

@ -4,7 +4,6 @@
int main()
{
kolibri_dialog_init(); // dialog init
open_dialog *dlg_open = kolibri_new_open_dialog(OPEN, 10, 10, 420, 320); // create opendialog struct
OpenDialog_init(dlg_open); // Initializing an open dialog box.
OpenDialog_start(dlg_open); // Show open dialog box

View File

@ -44,18 +44,13 @@ void* load_img(char* fname, uint32_t* read_sz){ // Image file upload function
void draw_gui(){
_ksys_start_draw();
_ksys_create_window(10, 40, (IMG_W+NEW_IMG_W)+50, IMG_H+50, "Libimg", sys_color_table.work_area, 0x34);
img_draw(image_blend, 10, 10, IMG_W*2, IMG_H , 0, 0); // Draw blended image to window
_ksys_create_window(10, 40, (IMG_W+NEW_IMG_W)+50, IMG_H+50, "Libimg", sys_color_table.work_area, 0x34);
img_draw(image_blend, 10, 10, IMG_W*2, IMG_H , 0, 0); // Draw blended image to window
_ksys_end_draw();
}
int main(){
if (kolibri_libimg_init() == -1){
printf("Error loading lib_img.obj\n");
exit(0);
}
_ksys_get_system_colors(&sys_color_table); // Get system colors theme
_ksys_get_system_colors(&sys_color_table); // Get system colors theme
_ksys_set_event_mask(0xC0000027);
uint32_t img_size;

View File

@ -0,0 +1,49 @@
#include "stddef.h"
#include <stdio.h>
#include <stdlib.h>
#include <libgen.h>
#include <string.h>
#include <sys/ksys.h>
#define ARGC_VALID 3
enum ARGV_FILE {
IN = 1,
OUT = 2
};
void show_help(void){
puts("Usage: defgen [lib.obj] [lib.def]");
}
int main(int argc, char** argv){
if(argc!=ARGC_VALID){
show_help();
return 0;
}
ksys_dll_t *obj_dll = _ksys_dlopen(argv[IN]);
FILE* outfile = fopen(argv[OUT], "w");
if(!obj_dll){
printf("File '%s' not found!\n", argv[IN]);
return 1;
}
if(!outfile){
printf("Unable to create file:'%s'!\n", argv[OUT]);
return 2;
}
fprintf(outfile, "LIBRARY %s\n\n", basename(argv[IN]));
fputs("EXPORTS\n", outfile);
int i=0;
while(obj_dll[i].func_name){
fprintf(outfile,"%s\n", obj_dll[i].func_name);
i++;
}
fclose(outfile);
return 0;
}

View File

@ -3,11 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
int errno;
int main() {
networklib_init();
char *host = "kolibrios.org";
int port = 80;
printf("Connecting to %s on port %d\n", host, port);

View File

@ -8,7 +8,7 @@ int main(int argc, char** argv){
char hello1[]="Hello, KolibriOS!";
char hello2[20];
memcpy(hello1, hello2, strlen(hello1));
if(!_ksys_strcmp(hello1, hello2)){
if(!__strcmp(hello1, hello2)){
printf("memcpy: Successfully!\n");
return 0;
} else{

View File

@ -5,8 +5,6 @@ https://www.binarytides.com/whois-client-code-in-c-with-linux-sockets/
*/
#include <errno.h>
int errno;
#include "sys/ksys.h"
#include <stdio.h>
#include <string.h>
@ -42,8 +40,7 @@ char* str_copy(char*);
int main(int argc , char *argv[])
{
networklib_init();
{
char *domain , *data = NULL;
int f_flag=0;