diff --git a/programs/develop/binutils/bin/README.TXT b/programs/develop/binutils/bin/README.TXT new file mode 100644 index 0000000000..58f8277e3a --- /dev/null +++ b/programs/develop/binutils/bin/README.TXT @@ -0,0 +1,4 @@ +These binaries are not built from the "/contrib/toolchain/binutils" folder. +This is a modification of Serge's original binutils. +Collected for output to console.obj and not debug board. +My fork page: "https://github.com/turbocat2001/binutils-kex" diff --git a/programs/develop/binutils/bin/ar b/programs/develop/binutils/bin/ar new file mode 100755 index 0000000000..dc36786b46 Binary files /dev/null and b/programs/develop/binutils/bin/ar differ diff --git a/programs/develop/binutils/bin/objcopy b/programs/develop/binutils/bin/objcopy new file mode 100755 index 0000000000..3e2c6a514c Binary files /dev/null and b/programs/develop/binutils/bin/objcopy differ diff --git a/programs/develop/binutils/bin/strip b/programs/develop/binutils/bin/strip new file mode 100755 index 0000000000..8b64c61b53 Binary files /dev/null and b/programs/develop/binutils/bin/strip differ diff --git a/programs/develop/ktcc/trunk/libc/include/kos/msgbox.h b/programs/develop/ktcc/trunk/libc/include/kos/msgbox.h new file mode 100644 index 0000000000..ba5d421938 --- /dev/null +++ b/programs/develop/ktcc/trunk/libc/include/kos/msgbox.h @@ -0,0 +1,55 @@ +#ifndef KOLIBRI_MSGBOX_H +#define KOLIBRI_MSGBOX_H +#include +#include +#include +#include + + +typedef struct { + uint8_t retval; // 0 - win closed, 1 to n - button num, also default button on start + uint8_t reserv; + char texts[2048]; // must be enough ;-) + char msgbox_stack[1024]; + uint32_t top_stack; +}__attribute__((packed)) msgbox; + +typedef void (*msgbox_callback)(void); + +extern void (*msgbox_create)(msgbox *, void *thread) __attribute__((__stdcall__)); // clears callbacks, ! if fix lib, we can return eax as of Fn51 +extern void (*msgbox_setfunctions)(msgbox_callback*) __attribute__((__stdcall__)); // must be called immediately after create, zero-ended array +extern void (*msgbox_reinit)(msgbox *) __attribute__((__stdcall__)); // recalc sizes when structure changes, called auto when MsgBoxCreate + +static inline msgbox* kolibri_new_msgbox(char* title, char* text, int def_but, ...) +/// text can be multilined by code 13 = "\r" +/// def_but - highlighted and used on Enter (if zero - default is [X]), user may use Tabs or Arrows +/// last params are buttons text, max 8. last must set as NULL +{ + va_list vl=0; + va_start(vl, def_but); + msgbox* box = calloc(sizeof(msgbox), 1); + box->retval = (uint8_t)def_but; + char *pc = box->texts; + strcpy(pc, title); + pc += strlen(title) + 1; + strcpy(pc, text); + pc += strlen(text) + 1; + char *but_text = va_arg(vl, char*); + while (but_text) + { + strcpy(pc, but_text); + pc += strlen(but_text) + 1; + but_text = va_arg(vl, char*); + } + + va_end(vl); + return box; +} + +static inline void kolibri_start_msgbox(msgbox* box, msgbox_callback cb[]) +{ + (*msgbox_create)(box, &box->top_stack); + if (cb) (*msgbox_setfunctions)(cb); +} + +#endif diff --git a/programs/develop/ktcc/trunk/samples/build_all.sh b/programs/develop/ktcc/trunk/samples/build_all.sh index 3a62bc78c4..8ea7d4359e 100644 --- a/programs/develop/ktcc/trunk/samples/build_all.sh +++ b/programs/develop/ktcc/trunk/samples/build_all.sh @@ -4,4 +4,6 @@ ../tcc files.c /kolibrios/develop/tcc/lib/libck.a -o files ../tcc winbasics.c /kolibrios/develop/tcc/lib/libck.a -o winbasics ../tcc dynamic.c -lconsole -lhttp -linputbox -o dynamic -exit \ No newline at end of file +../tcc load_coff.c -o load_coff -lck +../tcc msgbox.c -lck -lmsgbox -o msgbox +exit diff --git a/programs/develop/ktcc/trunk/samples/load_coff.c b/programs/develop/ktcc/trunk/samples/load_coff.c new file mode 100644 index 0000000000..d4c73fbe3b --- /dev/null +++ b/programs/develop/ktcc/trunk/samples/load_coff.c @@ -0,0 +1,21 @@ +#include + +/*Using the "coff" library in ktcc using "inputbox.obj" as an example*/ + +unsigned (*InputBox)(void* Buffer, char* Caption, char* Prompt, char* Default, unsigned long Flags, unsigned long BufferSize, void* RedrawProc); + +void *InputBoxLib; + +void load_coff() +{ + InputBoxLib = dlopen("/sys/lib/inputbox.obj", RTLD_GLOBAL); + InputBox = dlsym(InputBoxLib,"InputBox"); +} + +int main() +{ + load_coff(); + char buffer[256]; + InputBox(buffer, "Hay!", "How do you do?", "Hmm?", 10, 256, 0); + dlclose(InputBoxLib); +} diff --git a/programs/develop/ktcc/trunk/samples/msgbox.c b/programs/develop/ktcc/trunk/samples/msgbox.c new file mode 100644 index 0000000000..7d34bd2cd8 --- /dev/null +++ b/programs/develop/ktcc/trunk/samples/msgbox.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + msgbox *msg1=NULL; + msg1 = kolibri_new_msgbox("MsgBoxTest", "Hello world!", 0, "ok"); + kolibri_start_msgbox(msg1, NULL); +}