/programs/develop/ktcc/trunk/bin/lib/libck.a |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/develop/ktcc/trunk/libc/include/kos/console.h |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/include/kos32sys1.h |
---|
40,7 → 40,9 |
//Read/Write data as type (int char, etc.) at address "addr" with offset "offset". eg DATA(int, buff, 8); |
#define DATA(type, addr, offset) *((type*)((uint8_t*)addr+offset)) |
#define X_W(X, W) ((X<<16)+W) |
#define Y_H X_W |
typedef struct { |
uint8_t blue; |
uint8_t green; |
748,28 → 750,6 |
return val; |
} |
//added nonstatic inline because incomfortabre stepping in in debugger |
void __attribute__ ((noinline)) debug_board_write_str(const char* str); |
void __attribute__ ((noinline)) debug_board_printf(const char *format,...); |
/* copy body to only one project file |
void __attribute__ ((noinline)) debug_board_write_str(const char* str){ |
while(*str) |
debug_board_write_byte(*str++); |
} |
void __attribute__ ((noinline)) debug_board_printf(const char *format,...) |
{ |
va_list ap; |
char log_board[300]; |
va_start (ap, format); |
vsnprintf(log_board, sizeof log_board, format, ap); |
va_end(ap); |
debug_board_write_str(log_board); |
} |
*/ |
// TinyC don't support aliasing of static inline funcs, but support #define :) |
#ifndef __TINYC__ |
static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw"))); |
/programs/develop/ktcc/trunk/libc/include/stdio.h |
---|
62,9 → 62,9 |
extern int cdecl fprintf(FILE* file, const char* format,...); |
extern int fscanf(FILE* file,const char* format,...); |
extern int ungetc(int c,FILE* file); |
extern int cdecl printf(const char *format,...); |
extern int cdecl printf(const char *format,...); |
extern int vsnprintf(char *dest, size_t size,const char *format,va_list ap); |
extern int cdecl snprintf(char *dest, size_t size, const char *format,...); |
extern int cdecl sprintf(char *dest,const char *format,...); |
93,6 → 93,8 |
int vsprintf (char * s, const char * format, va_list arg ); |
int vfprintf ( FILE * stream, const char * format, va_list arg ); |
//debug |
void debug_printf(const char *format,...); |
int tiny_sprintf (char * s, const char * format, ... ); |
int tiny_snprintf (char * s, size_t n, const char * format, ... ); |
/programs/develop/ktcc/trunk/libc/stdio/debug.c |
---|
0,0 → 1,12 |
#include <stdarg.h> |
#include <kolibrisys.h> |
void debug_printf(const char *format,...) |
{ |
va_list ap; |
char log_board[300]; |
va_start (ap, format); |
vsnprintf(log_board, sizeof log_board, format, ap); |
va_end(ap); |
debug_out_str(log_board); |
} |
/programs/develop/ktcc/trunk/samples/build_all.sh |
---|
14,6 → 14,7 |
../tcc dir_example.c -lck -o /tmp0/1/dir_example |
../tcc net/tcpsrv_demo.c -lck -o /tmp0/1/tcpsrv_demo |
../tcc net/nslookup.c -lck -lnetwork -o /tmp0/1/nslookup |
../tcc net/http_tcp_demo.c -lck -lnetwork -o /tmp0/1/http_tcp_demo |
../tcc getopt_ex.c -lck -o /tmp0/1/getopt_ex |
../tcc tinygl/fps.c tinygl/gears.c -o /tmp0/1/gears -ltinygl -lck |
exit |
/programs/develop/ktcc/trunk/samples/winbasics.c |
---|
1,8 → 1,6 |
/* |
newlib-style window example |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
10,6 → 8,8 |
#include "kos32sys1.h" |
struct kolibri_system_colors sys_color_table; |
void __attribute__ ((noinline)) debug_board_printf(const char *format,...); |
void __attribute__ ((noinline)) debug_board_write_str(const char* str); |
char statusbar[255]; |
char proc_info[1024]; |
66,17 → 66,17 |
end_draw(); |
} |
int main() |
{ |
int main() |
{ |
int gui_event; |
uint32_t pressed_button = 0, mouse_button; |
pos_t mouse_pos; |
strcpy(statusbar, "Program running...Double click on TEXT for details"); |
strcpy(statusbar, "Program running...Double click on TEXT for details"); |
get_system_colors(&sys_color_table); |
set_event_mask(0xC0000027); // mouse events only when focused window and mouse inside |
set_event_mask(0xC0000027); // mouse events only when focused window and mouse inside |
do /* Start of main activity loop */ |
do /* Start of main activity loop */ |
{ |
// gui_event = wait_for_event(10); // 100 = 1 sec, case you have background work |
gui_event = get_os_event(); |
92,22 → 92,22 |
// scroll |
break; |
case KOLIBRI_EVENT_BUTTON: |
pressed_button = get_os_button(); |
switch (pressed_button) |
{ |
pressed_button = get_os_button(); |
switch (pressed_button) |
{ |
case BTN_POP: |
strcpy(statusbar, "POP pressed...."); |
draw_window(); |
break; |
draw_window(); |
break; |
case BTN_UNLOCK: |
strcpy(statusbar, "UNLOCK pressed...."); |
strcpy(statusbar, "UNLOCK pressed...."); |
draw_window(); |
break; |
case BTN_QUIT: |
return 0; |
break; |
} |
break; |
break; |
case BTN_QUIT: |
return 0; |
break; |
} |
break; |
case KOLIBRI_EVENT_MOUSE: |
mouse_pos = get_mouse_pos(POS_WINDOW); // window relative |
mouse_button = get_mouse_eventstate(); |
117,24 → 117,24 |
int n = (mouse_pos.y - 60) / FONT_H; |
if (n < 0 || n >= LINES) break; |
debug_board_printf("click on str(%d), clip slot(%d)\n", n, LINES - n - 1); |
tiny_sprintf(statusbar, "click on str(%d), clip slot(%d)\n", n, LINES - n - 1); |
tiny_sprintf(statusbar, "click on str(%d), clip slot(%d)\n", n, LINES - n - 1); |
draw_window(); |
} |
// ignore |
break; |
break; |
} |
} while(1) ; /* End of main activity loop */ |
return 0; |
} |
} while(1) ; /* End of main activity loop */ |
return 0; |
} |
void __attribute__ ((noinline)) debug_board_write_str(const char* str){ |
while(*str) |
debug_board_write_byte(*str++); |
} |
void __attribute__ ((noinline)) debug_board_write_str(const char* str){ |
while(*str) |
debug_board_write_byte(*str++); |
} |
void __attribute__ ((noinline)) debug_board_printf(const char *format,...) |
{ |
va_list ap; |