forked from KolibriOS/kolibrios
libc.obj: Updated samples.
git-svn-id: svn://kolibrios.org@9553 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1eff55fdee
commit
0428045f25
@ -1,31 +1,30 @@
|
|||||||
KTCC=kos32-tcc
|
KTCC=../../bin/kos32-tcc
|
||||||
FASM= fasm
|
FASM= fasm
|
||||||
KPACK = kpack
|
KPACK = kpack
|
||||||
|
|
||||||
CFLAGS = -I../include -I../../../../../../contrib/sdk/sources/SDL-1.2.2_newlib/include
|
CFLAGS = -I../include -I../../../../../../contrib/sdk/sources/SDL-1.2.2_newlib/include
|
||||||
LDFLAGS = -nostdlib -L../../bin/lib ../../bin/lib/crt0.o
|
LIBS = -lbox_lib -lshell -lSDL -lsound -lnetwork -lrasterworks -limg -ldialog -lmsgbox
|
||||||
|
|
||||||
BIN= stdio_test.kex \
|
BIN = stdio_test.kex \
|
||||||
basic_gui.kex \
|
basic_gui.kex \
|
||||||
http_tcp_demo.kex \
|
http_tcp_demo.kex \
|
||||||
math_test.kex \
|
math_test.kex \
|
||||||
string_test.kex \
|
string_test.kex \
|
||||||
whois.kex \
|
whois.kex \
|
||||||
file_io.kex \
|
file_io.kex \
|
||||||
tmpdisk_work.kex \
|
tmpdisk_work.kex \
|
||||||
consoleio.kex \
|
consoleio.kex \
|
||||||
assert_test.kex \
|
assert_test.kex \
|
||||||
fasm/sprintf_test.kex \
|
clayer/rasterworks.kex \
|
||||||
clayer/rasterworks.kex \
|
clayer/libimg.kex \
|
||||||
clayer/libimg.kex \
|
clayer/dialog.kex \
|
||||||
clayer/dialog.kex \
|
clayer/msgbox.kex \
|
||||||
clayer/msgbox.kex \
|
clayer/boxlib.kex \
|
||||||
clayer/boxlib.kex \
|
thread_work.kex \
|
||||||
thread_work.kex \
|
sdltest.kex \
|
||||||
sdltest.kex \
|
shell_test.kex \
|
||||||
shell_test.kex \
|
libc_test.kex \
|
||||||
libc_test.kex
|
defgen.kex
|
||||||
|
|
||||||
LIBS= -lSDL -lshell -ltcc -lsound -ldialog -lrasterworks -limg -lbox -lmsgbox -lnetwork -lc.obj
|
|
||||||
|
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ all: $(BIN)
|
|||||||
$(KTCC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
|
$(KTCC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
|
||||||
$(KPACK) --nologo $@
|
$(KPACK) --nologo $@
|
||||||
|
|
||||||
%.kex : %.asm
|
-%.kex : %.asm
|
||||||
$(FASM) $< $@
|
$(FASM) $< $@
|
||||||
$(KPACK) --nologo $@
|
$(KPACK) --nologo $@
|
||||||
|
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
#SHS
|
#SHS
|
||||||
mkdir /tmp0/1/tcc_samples
|
mkdir /tmp0/1/tcc_samples
|
||||||
../tcc file_io.c -o /tmp0/1/tcc_samples/file_io -lc.obj
|
../tcc file_io.c -o /tmp0/1/tcc_samples/file_io
|
||||||
../tcc whois.c -o /tmp0/1/tcc_samples/whois -ltcc -lnetwork -lc.obj
|
../tcc whois.c -o /tmp0/1/tcc_samples/whois -lnetwork
|
||||||
../tcc stdio_test.c -o /tmp0/1/tcc_samples/stdio_test -lc.obj
|
../tcc stdio_test.c -o /tmp0/1/tcc_samples/stdio_test
|
||||||
../tcc basic_gui.c -o /tmp0/1/tcc_samples/basic_gui -ltcc -lc.obj
|
../tcc basic_gui.c -o /tmp0/1/tcc_samples/basic_gui
|
||||||
../tcc consoleio.c -o /tmp0/1/tcc_samples/consoleio -lc.obj
|
../tcc consoleio.c -o /tmp0/1/tcc_samples/consoleio
|
||||||
../tcc dir_example.c -o /tmp0/1/tcc_samples/ls_dir -lc.obj
|
../tcc dir_example.c -o /tmp0/1/tcc_samples/ls_dir
|
||||||
../tcc http_tcp_demo.c -o /tmp0/1/tcc_samples/http_tcp_demo -ltcc -lnetwork -lc.obj
|
../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 -ltcc -lc.obj
|
../tcc math_test.c -o /tmp0/1/tcc_samples/math_test
|
||||||
../tcc string_test.c -o /tmp0/1/tcc_samples/string_test -ltcc -lc.obj
|
../tcc string_test.c -o /tmp0/1/tcc_samples/string_test
|
||||||
../tcc tmpdisk_work.c -o /tmp0/1/tcc_samples/tmpdisk_work -ltcc -lc.obj
|
../tcc tmpdisk_work.c -o /tmp0/1/tcc_samples/tmpdisk_work
|
||||||
../tcc clayer/boxlib.c -o /tmp0/1/tcc_samples/boxlib -ltcc -lbox -lc.obj
|
../tcc clayer/boxlib.c -o /tmp0/1/tcc_samples/boxlib -lbox_lib
|
||||||
../tcc clayer/dialog.c -o /tmp0/1/tcc_samples/dialog -ltcc -ldialog -lc.obj
|
../tcc clayer/dialog.c -o /tmp0/1/tcc_samples/dialog -ldialog
|
||||||
cp clayer/logo.png /tmp0/1/tcc_samples/logo.png
|
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/libimg.c -o /tmp0/1/tcc_samples/libimg -limg
|
||||||
../tcc clayer/msgbox.c -o /tmp0/1/tcc_samples/msgbox -ltcc -lmsgbox -lc.obj
|
../tcc clayer/msgbox.c -o /tmp0/1/tcc_samples/msgbox -lmsgbox
|
||||||
../tcc clayer/rasterworks.c -o /tmp0/1/tcc_samples/rasterworks -ltcc -lrasterworks -lc.obj
|
../tcc clayer/rasterworks.c -o /tmp0/1/tcc_samples/rasterworks -lrasterworks
|
||||||
../tcc thread_work.c -o /tmp0/1/tcc_samples/thread_work -ltcc -lc.obj
|
../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 -ltcc -lc.obj
|
../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 -ltcc -lc.obj
|
../tcc shell_test.c -o /tmp0/1/tcc_samples/shell_test -lshell
|
||||||
../tcc libc_test.c -o /tmp0/1/tcc_samples/libc_test -ltcc -lc.obj
|
../tcc libc_test.c -o /tmp0/1/tcc_samples/libc_test
|
||||||
"/sys/File managers/Eolite" /tmp0/1/tcc_samples
|
"/sys/File managers/Eolite" /tmp0/1/tcc_samples
|
||||||
exit
|
exit
|
||||||
|
@ -42,10 +42,8 @@ void draw_window(){
|
|||||||
_ksys_end_draw();
|
_ksys_end_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
kolibri_boxlib_init();
|
|
||||||
init_checkbox2(&output_off);
|
init_checkbox2(&output_off);
|
||||||
_ksys_set_event_mask(KSYS_EVM_REDRAW + KSYS_EVM_KEY + KSYS_EVM_BUTTON + KSYS_EVM_MOUSE+ KSYS_EVM_MOUSE_FILTER);
|
_ksys_set_event_mask(KSYS_EVM_REDRAW + KSYS_EVM_KEY + KSYS_EVM_BUTTON + KSYS_EVM_MOUSE+ KSYS_EVM_MOUSE_FILTER);
|
||||||
while(1){
|
while(1){
|
||||||
@ -55,7 +53,7 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KSYS_EVENT_KEY:
|
case KSYS_EVENT_KEY:
|
||||||
edit_box_key(&ed, _ksys_get_key().val);
|
edit_box_key_safe(&ed, _ksys_get_key());
|
||||||
draw_window();
|
draw_window();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
kolibri_dialog_init(); // dialog init
|
|
||||||
open_dialog *dlg_open = kolibri_new_open_dialog(OPEN, 10, 10, 420, 320); // create opendialog struct
|
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_init(dlg_open); // Initializing an open dialog box.
|
||||||
OpenDialog_start(dlg_open); // Show open dialog box
|
OpenDialog_start(dlg_open); // Show open dialog box
|
||||||
|
@ -44,18 +44,13 @@ void* load_img(char* fname, uint32_t* read_sz){ // Image file upload function
|
|||||||
|
|
||||||
void draw_gui(){
|
void draw_gui(){
|
||||||
_ksys_start_draw();
|
_ksys_start_draw();
|
||||||
_ksys_create_window(10, 40, (IMG_W+NEW_IMG_W)+50, IMG_H+50, "Libimg", sys_color_table.work_area, 0x34);
|
_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
|
img_draw(image_blend, 10, 10, IMG_W*2, IMG_H , 0, 0); // Draw blended image to window
|
||||||
_ksys_end_draw();
|
_ksys_end_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
if (kolibri_libimg_init() == -1){
|
_ksys_get_system_colors(&sys_color_table); // Get system colors theme
|
||||||
printf("Error loading lib_img.obj\n");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ksys_get_system_colors(&sys_color_table); // Get system colors theme
|
|
||||||
_ksys_set_event_mask(0xC0000027);
|
_ksys_set_event_mask(0xC0000027);
|
||||||
|
|
||||||
uint32_t img_size;
|
uint32_t img_size;
|
||||||
|
49
programs/develop/ktcc/trunk/libc.obj/samples/defgen.c
Normal file
49
programs/develop/ktcc/trunk/libc.obj/samples/defgen.c
Normal 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;
|
||||||
|
}
|
@ -3,11 +3,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int errno;
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
networklib_init();
|
|
||||||
|
|
||||||
char *host = "kolibrios.org";
|
char *host = "kolibrios.org";
|
||||||
int port = 80;
|
int port = 80;
|
||||||
printf("Connecting to %s on port %d\n", host, port);
|
printf("Connecting to %s on port %d\n", host, port);
|
||||||
|
@ -8,7 +8,7 @@ int main(int argc, char** argv){
|
|||||||
char hello1[]="Hello, KolibriOS!";
|
char hello1[]="Hello, KolibriOS!";
|
||||||
char hello2[20];
|
char hello2[20];
|
||||||
memcpy(hello1, hello2, strlen(hello1));
|
memcpy(hello1, hello2, strlen(hello1));
|
||||||
if(!_ksys_strcmp(hello1, hello2)){
|
if(!__strcmp(hello1, hello2)){
|
||||||
printf("memcpy: Successfully!\n");
|
printf("memcpy: Successfully!\n");
|
||||||
return 0;
|
return 0;
|
||||||
} else{
|
} else{
|
||||||
|
@ -5,8 +5,6 @@ https://www.binarytides.com/whois-client-code-in-c-with-linux-sockets/
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
int errno;
|
|
||||||
|
|
||||||
#include "sys/ksys.h"
|
#include "sys/ksys.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -43,7 +41,6 @@ char* str_copy(char*);
|
|||||||
|
|
||||||
int main(int argc , char *argv[])
|
int main(int argc , char *argv[])
|
||||||
{
|
{
|
||||||
networklib_init();
|
|
||||||
char *domain , *data = NULL;
|
char *domain , *data = NULL;
|
||||||
int f_flag=0;
|
int f_flag=0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user