forked from KolibriOS/kolibrios
Update skipped files in previous commit
git-svn-id: svn://kolibrios.org@9766 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
cde4fa851d
commit
99922e4c2c
@ -66,11 +66,8 @@ qsort
|
||||
strtod
|
||||
__assert_fail
|
||||
;____STRING____
|
||||
;memcpy
|
||||
memchr
|
||||
memcmp
|
||||
!memmove
|
||||
!memset
|
||||
strncat
|
||||
strchr
|
||||
strcat
|
||||
@ -90,7 +87,7 @@ strspn
|
||||
strstr
|
||||
strtok
|
||||
strxfrm
|
||||
_errno
|
||||
__errno
|
||||
;____SYS____
|
||||
closedir
|
||||
opendir
|
||||
|
6
programs/develop/ktcc/trunk/libc.obj/.clang-format
Executable file
6
programs/develop/ktcc/trunk/libc.obj/.clang-format
Executable file
@ -0,0 +1,6 @@
|
||||
# Format Style Options - Created with Clang Power Tools
|
||||
---
|
||||
BasedOnStyle: WebKit
|
||||
AlignTrailingComments: true
|
||||
AlignConsecutiveMacros: true
|
||||
...
|
@ -4,6 +4,10 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define assert(x) (void)0
|
||||
#else
|
||||
#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__), 0)))
|
||||
#endif
|
||||
|
||||
#endif // _ASSERT_H_
|
@ -3,9 +3,9 @@
|
||||
#ifndef KOLIBRI_BOXLIB_H
|
||||
#define KOLIBRI_BOXLIB_H
|
||||
|
||||
#include <sys/ksys.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
typedef unsigned color_t;
|
||||
int kolibri_boxlib_init(void);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef KOLIBRI_BUF2D_H
|
||||
#define KOLIBRI_BUF2D_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned int* buf_pointer;
|
||||
|
@ -43,7 +43,6 @@ typedef struct {
|
||||
unsigned short y_start;
|
||||
} open_dialog __attribute__((__packed__));
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned int type;
|
||||
char* procinfo;
|
||||
|
@ -1,5 +1,4 @@
|
||||
/*
|
||||
|
||||
This is adapded thunk for console.obj sys library
|
||||
.h is equal to svn:\programs\develop\libraries\console\console_en.txt
|
||||
|
||||
|
@ -3,148 +3,58 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _BUILD_LIBC
|
||||
extern int _errno;
|
||||
#define errno _errno
|
||||
#define errno __errno
|
||||
extern int __errno;
|
||||
#else
|
||||
extern int* _errno;
|
||||
#define errno *_errno
|
||||
extern int* __errno;
|
||||
#define errno *__errno
|
||||
#endif
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* Input/output error */
|
||||
#define ENXIO 6 /* Device not configured */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file descriptor */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EDEADLK 11 /* Resource deadlock avoided */
|
||||
/* 11 was EAGAIN */
|
||||
#define ENOMEM 12 /* Cannot allocate memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device / Resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* Operation not supported by device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* Too many open files in system */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Inappropriate ioctl for device */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define ENOTSUP 2 // Function is not supported
|
||||
#define EUNKNFS 3 // Unknown file system
|
||||
#define ENOTFOUND 5 // File not found
|
||||
#define EEOF 6 // End of file
|
||||
#define EFAULT 7 // Pointer lies outside of application memory
|
||||
#define EDQUOT 8 // Disk is full
|
||||
#define EFS 9 // File system error
|
||||
#define EACCES 10 // Access denied
|
||||
#define EDEV 11 // Device error
|
||||
#define ENOMEMFS 12 // File system requires more memory
|
||||
|
||||
/* math software */
|
||||
#define EDOM 33 /* Numerical argument out of domain */
|
||||
#define ERANGE 34 /* Result too large */
|
||||
#define ENOMEM 30 // Not enough memory
|
||||
#define ENOEXEC 31 // Is not executable
|
||||
#define EPROCLIM 32 // Too many processes
|
||||
#define EINVAL 33 // Invalid argument
|
||||
|
||||
/* non-blocking and interrupt i/o */
|
||||
#define EAGAIN 35 /* Resource temporarily unavailable */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define EINPROGRESS 36 /* Operation now in progress */
|
||||
#define EALREADY 37 /* Operation already in progress */
|
||||
#define EDOM 50 // Numerical argument out of domain
|
||||
#define ERANGE 51 // Result too large
|
||||
#define EILSEQ 52 // Illegal byte sequence
|
||||
|
||||
/* ipc/network software -- argument errors */
|
||||
#define ENOTSOCK 38 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 39 /* Destination address required */
|
||||
#define EMSGSIZE 40 /* Message too long */
|
||||
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 42 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 43 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
|
||||
#define ENOTSUP 45 /* Operation not supported */
|
||||
#define EOPNOTSUPP ENOTSUP /* Operation not supported on socket */
|
||||
#define EPFNOSUPPORT 46 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
|
||||
#define EADDRINUSE 48 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
|
||||
#define ENOBUFS 60 // Broken buffer
|
||||
#define EINPROGRESS 61 // Operation now in progress
|
||||
#define EOPNOTSUPP 62 // Operation not supported on transport endpoint
|
||||
#define EWOULDBLOCK 63 // Operation would block
|
||||
#define ENOTCONN 64 // Transport endpoint is not connected
|
||||
#define EALREADY 65 // Operation already in progress
|
||||
#define EMSGSIZE 66 // Message too long
|
||||
#define EADDRINUSE 67 // Address already in use
|
||||
#define ECONNREFUSED 68 // Connection refused
|
||||
#define ECONNRESET 69 // Connection reset by peer
|
||||
#define EISCONN 70 // Transport endpoint is already connected
|
||||
#define ETIMEDOUT 71 // Connection timed out
|
||||
#define ECONNABORTED 72 // Software caused connection abort
|
||||
|
||||
/* ipc/network software -- operational errors */
|
||||
#define ENETDOWN 50 /* Network is down */
|
||||
#define ENETUNREACH 51 /* Network is unreachable */
|
||||
#define ENETRESET 52 /* Network dropped connection on reset */
|
||||
#define ECONNABORTED 53 /* Software caused connection abort */
|
||||
#define ECONNRESET 54 /* Connection reset by peer */
|
||||
#define ENOBUFS 55 /* No buffer space available */
|
||||
#define EISCONN 56 /* Socket is already connected */
|
||||
#define ENOTCONN 57 /* Socket is not connected */
|
||||
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
|
||||
#define ETOOMANYREFS 59 /* Too many references: can't splice */
|
||||
#define ETIMEDOUT 60 /* Operation timed out */
|
||||
#define ECONNREFUSED 61 /* Connection refused */
|
||||
#define ELOOP 62 /* Too many levels of symbolic links */
|
||||
#define ENAMETOOLONG 63 /* File name too long */
|
||||
/*
|
||||
* UNIX-like errno
|
||||
* Will be removed after changing STDIO.
|
||||
*/
|
||||
|
||||
/* should be rearranged */
|
||||
#define EHOSTDOWN 64 /* Host is down */
|
||||
#define EHOSTUNREACH 65 /* No route to host */
|
||||
#define ENOTEMPTY 66 /* Directory not empty */
|
||||
|
||||
/* quotas & mush */
|
||||
#define EPROCLIM 67 /* Too many processes */
|
||||
#define EUSERS 68 /* Too many users */
|
||||
#define EDQUOT 69 /* Disc quota exceeded */
|
||||
|
||||
/* Network File System */
|
||||
#define ESTALE 70 /* Stale NFS file handle */
|
||||
#define EREMOTE 71 /* Too many levels of remote in path */
|
||||
#define EBADRPC 72 /* RPC struct is bad */
|
||||
#define ERPCMISMATCH 73 /* RPC version wrong */
|
||||
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
|
||||
#define EPROGMISMATCH 75 /* Program version wrong */
|
||||
#define EPROCUNAVAIL 76 /* Bad procedure for program */
|
||||
#define ENOLCK 77 /* No locks available */
|
||||
#define ENOSYS 78 /* Function not implemented */
|
||||
#define EFTYPE 79 /* Inappropriate file type or format */
|
||||
#define EAUTH 80 /* Authentication error */
|
||||
#define ENEEDAUTH 81 /* Need authenticator */
|
||||
|
||||
/* Intelligent device errors */
|
||||
#define EPWROFF 82 /* Device power is off */
|
||||
#define EDEVERR 83 /* Device error, e.g. paper out */
|
||||
#define EOVERFLOW 84 /* Value too large to be stored in data type */
|
||||
|
||||
/* Program loading errors */
|
||||
#define EBADEXEC 85 /* Bad executable */
|
||||
#define EBADARCH 86 /* Bad CPU type in executable */
|
||||
#define ESHLIBVERS 87 /* Shared library version mismatch */
|
||||
#define EBADMACHO 88 /* Malformed Macho file */
|
||||
#define ECANCELED 89 /* Operation canceled */
|
||||
#define EIDRM 90 /* Identifier removed */
|
||||
#define ENOMSG 91 /* No message of desired type */
|
||||
#define EILSEQ 92 /* Illegal byte sequence */
|
||||
#define ENOATTR 93 /* Attribute not found */
|
||||
#define EBADMSG 94 /* Bad message */
|
||||
#define EMULTIHOP 95 /* Reserved */
|
||||
#define ENODATA 96 /* No message available on STREAM */
|
||||
#define ENOLINK 97 /* Reserved */
|
||||
#define ENOSR 98 /* No STREAM resources */
|
||||
#define ENOSTR 99 /* Not a STREAM */
|
||||
#define EPROTO 100 /* Protocol error */
|
||||
#define ETIME 101 /* STREAM ioctl timeout */
|
||||
#define ENOPOLICY 103 /* No such policy registered */
|
||||
#define ENOTRECOVERABLE 104 /* State not recoverable */
|
||||
#define EOWNERDEAD 105 /* Previous owner died */
|
||||
#define EQFULL 106 /* Interface output queue is full */
|
||||
#define ELAST 106 /* Must be equal largest errno */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define ENOTDIR 80
|
||||
#define EBADF 81
|
||||
#define EIO 82
|
||||
#define EISDIR 83
|
||||
#define ENOENT 84
|
||||
#define EOVERFLOW 85
|
||||
|
||||
#endif // _ERRNO_H_
|
||||
|
@ -32,7 +32,6 @@
|
||||
#define LONG_LONG_MAX LLONG_MAX
|
||||
#define ULONG_LONG_MAX ULLONG_MAX
|
||||
|
||||
|
||||
#ifndef ARG_MAX
|
||||
#define ARG_MAX 4096
|
||||
#endif
|
||||
|
@ -6,10 +6,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern double _FUNC(acos)(double _x);
|
||||
extern double _FUNC(asin)(double _x);
|
||||
extern double _FUNC(atan)(double _x);
|
||||
@ -32,6 +28,13 @@ extern double _FUNC(sinh)(double _x);
|
||||
extern double _FUNC(sqrt)(double _x);
|
||||
extern double _FUNC(tan)(double _x);
|
||||
extern double _FUNC(tanh)(double _x);
|
||||
extern double _FUNC(acosh)(double);
|
||||
extern double _FUNC(asinh)(double);
|
||||
extern double _FUNC(atanh)(double);
|
||||
extern double _FUNC(hypot)(double, double);
|
||||
extern long double _FUNC(modfl)(long double _x, long double* _pint);
|
||||
extern double _FUNC(pow10)(double _x);
|
||||
extern double _FUNC(pow2)(double _x);
|
||||
|
||||
#define M_E 2.7182818284590452354
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
@ -49,26 +52,6 @@ extern double _FUNC(tanh)(double _x);
|
||||
#define PI M_PI
|
||||
#define PI2 M_PI_2
|
||||
|
||||
extern double _FUNC(acosh)(double);
|
||||
extern double _FUNC(asinh)(double);
|
||||
extern double _FUNC(atanh)(double);
|
||||
extern double _FUNC(cbrt)(double);
|
||||
extern double _FUNC(exp10)(double _x);
|
||||
extern double _FUNC(exp2)(double _x);
|
||||
extern double _FUNC(expm1)(double);
|
||||
extern double _FUNC(hypot)(double, double);
|
||||
extern double _FUNC(log1p)(double);
|
||||
extern double _FUNC(log2)(double _x);
|
||||
extern long double _FUNC(modfl)(long double _x, long double *_pint);
|
||||
extern double _FUNC(pow10)(double _x);
|
||||
extern double _FUNC(pow2)(double _x);
|
||||
extern double _FUNC(powi)(double, int);
|
||||
extern void _FUNC(sincos)(double, double *, double *);
|
||||
|
||||
/* These are in libm.a (Cygnus). You must link -lm to get these */
|
||||
/* See libm/math.h for comments */
|
||||
|
||||
#ifndef __cplusplus
|
||||
struct exception {
|
||||
int type;
|
||||
const char* name;
|
||||
@ -77,95 +60,5 @@ struct exception {
|
||||
double retval;
|
||||
int err;
|
||||
};
|
||||
#endif
|
||||
|
||||
extern double _FUNC(erf)(double);
|
||||
extern double _FUNC(erfc)(double);
|
||||
extern double _FUNC(gamma)(double);
|
||||
extern int _FUNC(isinf)(double);
|
||||
extern int _FUNC(isnan)(double);
|
||||
extern int _FUNC(finite)(double);
|
||||
extern double _FUNC(j0)(double);
|
||||
extern double _FUNC(j1)(double);
|
||||
extern double _FUNC(jn)(int, double);
|
||||
extern double _FUNC(lgamma)(double);
|
||||
extern double _FUNC(nan)(const char*);
|
||||
extern double _FUNC(y0)(double);
|
||||
extern double _FUNC(y1)(double);
|
||||
extern double _FUNC(yn)(int, double);
|
||||
extern double _FUNC(logb)(double);
|
||||
extern double _FUNC(nextafter)(double, double);
|
||||
extern double _FUNC(remainder)(double, double);
|
||||
extern double _FUNC(scalb)(double, double);
|
||||
#ifndef __cplusplus
|
||||
extern int _FUNC(matherr)(struct exception *);
|
||||
#endif
|
||||
extern double _FUNC(significand)(double);
|
||||
extern double _FUNC(copysign)(double, double);
|
||||
extern int _FUNC(ilogb)(double);
|
||||
extern double _FUNC(rint)(double);
|
||||
extern double _FUNC(scalbn)(double, int);
|
||||
extern double _FUNC(drem)(double, double);
|
||||
extern double _FUNC(gamma_r)(double, int *);
|
||||
extern double _FUNC(lgamma_r)(double, int *);
|
||||
extern float _FUNC(acosf)(float);
|
||||
extern float _FUNC(asinf)(float);
|
||||
extern float _FUNC(atanf)(float);
|
||||
extern float _FUNC(atan2f)(float, float);
|
||||
extern float _FUNC(cosf)(float);
|
||||
extern float _FUNC(sinf)(float);
|
||||
extern float _FUNC(tanf)(float);
|
||||
extern float _FUNC(coshf)(float);
|
||||
extern float _FUNC(sinhf)(float);
|
||||
extern float _FUNC(tanhf)(float);
|
||||
extern float _FUNC(expf)(float);
|
||||
extern float _FUNC(frexpf)(float, int *);
|
||||
extern float _FUNC(ldexpf)(float, int);
|
||||
extern float _FUNC(logf)(float);
|
||||
extern float _FUNC(log10f)(float);
|
||||
extern float _FUNC(modff)(float, float *);
|
||||
extern float _FUNC(powf)(float, float);
|
||||
extern float _FUNC(sqrtf)(float);
|
||||
extern float _FUNC(ceilf)(float);
|
||||
extern float _FUNC(fabsf)(float);
|
||||
extern float _FUNC(floorf)(float);
|
||||
extern float _FUNC(fmodf)(float, float);
|
||||
extern float _FUNC(erff)(float);
|
||||
extern float _FUNC(erfcf)(float);
|
||||
extern float _FUNC(gammaf)(float);
|
||||
extern float _FUNC(hypotf)(float, float);
|
||||
extern int _FUNC(isinff)(float);
|
||||
extern int _FUNC(isnanf)(float);
|
||||
extern int _FUNC(finitef)(float);
|
||||
extern float _FUNC(j0f)(float);
|
||||
extern float _FUNC(j1f)(float);
|
||||
extern float _FUNC(jnf)(int, float);
|
||||
extern float _FUNC(lgammaf)(float);
|
||||
extern float _FUNC(nanf)(const char*);
|
||||
extern float _FUNC(y0f)(float);
|
||||
extern float _FUNC(y1f)(float);
|
||||
extern float _FUNC(ynf)(int, float);
|
||||
extern float _FUNC(acoshf)(float);
|
||||
extern float _FUNC(asinhf)(float);
|
||||
extern float _FUNC(atanhf)(float);
|
||||
extern float _FUNC(cbrtf)(float);
|
||||
extern float _FUNC(logbf)(float);
|
||||
extern float _FUNC(nextafterf)(float, float);
|
||||
extern float _FUNC(remainderf)(float, float);
|
||||
extern float _FUNC(scalbf)(float, float);
|
||||
extern float _FUNC(significandf)(float);
|
||||
extern float _FUNC(copysignf)(float, float);
|
||||
extern int _FUNC(ilogbf)(float);
|
||||
extern float _FUNC(rintf)(float);
|
||||
extern float _FUNC(scalbnf)(float, int);
|
||||
extern float _FUNC(dremf)(float, float);
|
||||
extern float _FUNC(expm1f)(float);
|
||||
extern float _FUNC(log1pf)(float);
|
||||
extern float _FUNC(gammaf_r)(float, int *);
|
||||
extern float _FUNC(lgammaf_r)(float, int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MATH_H_ */
|
@ -20,7 +20,9 @@ extern char *__shell_shm;
|
||||
extern int __shell_is_init;
|
||||
extern void __shell_init();
|
||||
|
||||
#define __SHELL_WAIT() while (*__shell_shm) _ksys_delay(5)
|
||||
#define __SHELL_WAIT() \
|
||||
while (*__shell_shm) \
|
||||
_ksys_delay(5)
|
||||
|
||||
extern int shell_ping();
|
||||
extern unsigned shell_get_pid();
|
||||
|
@ -3,72 +3,11 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __x86_64__
|
||||
#ifndef _WIN64
|
||||
|
||||
//This should be in sync with the declaration on our lib/libtcc1.c
|
||||
/* GCC compatible definition of va_list. */
|
||||
typedef struct {
|
||||
unsigned int gp_offset;
|
||||
unsigned int fp_offset;
|
||||
union {
|
||||
unsigned int overflow_offset;
|
||||
char *overflow_arg_area;
|
||||
};
|
||||
char *reg_save_area;
|
||||
} __va_list_struct;
|
||||
|
||||
typedef __va_list_struct va_list[1];
|
||||
|
||||
extern void _FUNC(__va_start)(__va_list_struct *ap, void *fp);
|
||||
extern void* _FUNC(__va_arg)(__va_list_struct *ap, int arg_type, int size, int align);
|
||||
|
||||
#define va_start(ap, last) __va_start(ap, __builtin_frame_address(0))
|
||||
#define va_arg(ap, type) \
|
||||
(*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type))))
|
||||
#define va_copy(dest, src) (*(dest) = *(src))
|
||||
#define va_end(ap)
|
||||
|
||||
#else /* _WIN64 */
|
||||
typedef char* va_list;
|
||||
#define va_start(ap,last) __builtin_va_start(ap,last)
|
||||
#define va_arg(ap,type) (ap += 8, sizeof(type)<=8 ? *(type*)ap : **(type**)ap)
|
||||
#define va_copy(dest, src) ((dest) = (src))
|
||||
#define va_end(ap)
|
||||
#endif
|
||||
|
||||
#elif __arm__
|
||||
typedef char *va_list;
|
||||
#define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
|
||||
#define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
|
||||
& ~(_tcc_alignof(type) - 1))
|
||||
#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
|
||||
#define va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
|
||||
&~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
|
||||
#define va_copy(dest, src) (dest) = (src)
|
||||
#define va_end(ap)
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
typedef struct {
|
||||
void *__stack;
|
||||
void *__gr_top;
|
||||
void *__vr_top;
|
||||
int __gr_offs;
|
||||
int __vr_offs;
|
||||
} va_list;
|
||||
#define va_start(ap, last) __va_start(ap, last)
|
||||
#define va_arg(ap, type) __va_arg(ap, type)
|
||||
#define va_end(ap)
|
||||
#define va_copy(dest, src) ((dest) = (src))
|
||||
|
||||
#else /* __i386__ */
|
||||
typedef char *va_list;
|
||||
/* only correct for i386 */
|
||||
#define va_start(ap, last) ap = ((char*)&(last)) + ((sizeof(last) + 3) & ~3)
|
||||
#define va_arg(ap, type) (ap += (sizeof(type) + 3) & ~3, *(type*)(ap - ((sizeof(type) + 3) & ~3)))
|
||||
#define va_copy(dest, src) (dest) = (src)
|
||||
#define va_end(ap)
|
||||
#endif
|
||||
|
||||
/* fix a buggy dependency on GCC in libio.h */
|
||||
typedef va_list __gnuc_va_list;
|
||||
|
@ -8,20 +8,6 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __PTRDIFF_TYPE__ intptr_t;
|
||||
typedef __SIZE_TYPE__ uintptr_t;
|
||||
|
||||
#ifndef __int8_t_defined
|
||||
#define __int8_t_defined
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef signed long long int int64_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
@ -15,18 +15,22 @@
|
||||
#define INT32_MAX (2147483647L)
|
||||
#define UINT32_MAX (4294967295UL)
|
||||
|
||||
#if __have_long64
|
||||
#define INT64_MIN (-9223372036854775807L-1L)
|
||||
#define INT64_MAX (9223372036854775807L)
|
||||
#define UINT64_MAX (18446744073709551615U)
|
||||
#elif __have_longlong64
|
||||
#define INT64_MIN (-9223372036854775807LL-1LL)
|
||||
#define INT64_MAX (9223372036854775807LL)
|
||||
#define UINT64_MAX (18446744073709551615ULL)
|
||||
#else
|
||||
#define INT64_MAX 0x7fffffffffffffffLL
|
||||
#define INT64_MIN (-INT64_MAX - 1LL)
|
||||
#define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL)
|
||||
|
||||
#ifndef __int8_t_defined
|
||||
#define __int8_t_defined
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef signed long long int int64_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
#endif
|
||||
|
||||
#define SIZE_MAX UINT32_MAX
|
||||
|
@ -11,15 +11,6 @@
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
extern int _FUNC(atoi)(const char *s);
|
||||
extern long _FUNC(atol)(const char *);
|
||||
extern long long _FUNC(atoll)(const char *);
|
||||
extern void _FUNC(itoa)(int n, char* s);
|
||||
|
||||
extern int _FUNC(abs)(int);
|
||||
extern long _FUNC(labs)(long);
|
||||
extern long long _FUNC(llabs)(long long);
|
||||
|
||||
typedef struct {
|
||||
int quot;
|
||||
int rem;
|
||||
@ -35,18 +26,18 @@ typedef struct {
|
||||
long long rem;
|
||||
} lldiv_t;
|
||||
|
||||
static inline
|
||||
div_t div(int num, int den) {
|
||||
static inline div_t div(int num, int den)
|
||||
{
|
||||
return (div_t) { num / den, num % den };
|
||||
}
|
||||
|
||||
static inline
|
||||
ldiv_t ldiv(long num, long den) {
|
||||
static inline ldiv_t ldiv(long num, long den)
|
||||
{
|
||||
return (ldiv_t) { num / den, num % den };
|
||||
}
|
||||
|
||||
static inline
|
||||
lldiv_t lldiv(long long num, long long den) {
|
||||
static inline lldiv_t lldiv(long long num, long long den)
|
||||
{
|
||||
return (lldiv_t) { num / den, num % den };
|
||||
}
|
||||
|
||||
@ -68,4 +59,13 @@ extern void _FUNC(qsort)(void *base0, size_t n, size_t size, int (*compar)(const
|
||||
extern double _FUNC(strtod)(const char* s, char** sret);
|
||||
extern double _FUNC(atof)(const char* ascii);
|
||||
|
||||
extern int _FUNC(atoi)(const char* s);
|
||||
extern long _FUNC(atol)(const char*);
|
||||
extern long long _FUNC(atoll)(const char*);
|
||||
extern void _FUNC(itoa)(int n, char* s);
|
||||
|
||||
extern int _FUNC(abs)(int);
|
||||
extern long _FUNC(labs)(long);
|
||||
extern long long _FUNC(llabs)(long long);
|
||||
|
||||
#endif
|
||||
|
@ -1,35 +1,10 @@
|
||||
/* String handling <string.h>
|
||||
|
||||
This file is part of the Public Domain C Library (PDCLib).
|
||||
Permission is granted to use, modify, and / or redistribute at will.
|
||||
*/
|
||||
|
||||
#ifndef _STRING_H_
|
||||
#define _STRING_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* String function conventions */
|
||||
|
||||
/*
|
||||
In any of the following functions taking a size_t n to specify the length of
|
||||
an array or size of a memory region, n may be 0, but the pointer arguments to
|
||||
the call shall still be valid unless otherwise stated.
|
||||
*/
|
||||
|
||||
/* Copying functions */
|
||||
|
||||
extern void* _FUNC(memccpy)(void* restrict dest, const void* restrict src, int c, size_t n);
|
||||
|
||||
/* Copy a number of n characters from the memory area pointed to by s2 to the
|
||||
area pointed to by s1. If the two areas overlap, behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
|
||||
#ifdef __TINYC__
|
||||
extern void* memcpy(void* s1, const void* s2, size_t n);
|
||||
extern void* memset(void* s, int c, size_t n);
|
||||
@ -40,142 +15,26 @@ extern void* _FUNC(memset)(void* s, int c, size_t n);
|
||||
extern void* _FUNC(memmove)(void* s1, const void* s2, size_t n);
|
||||
#endif
|
||||
|
||||
/* Copy the character array s2 (including terminating '\0' byte) into the
|
||||
character array s1.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strcpy)(char* s1, const char* s2);
|
||||
|
||||
/* Copy a maximum of n characters from the character array s2 into the character
|
||||
array s1. If s2 is shorter than n characters, '\0' bytes will be appended to
|
||||
the copy in s1 until n characters have been written. If s2 is longer than n
|
||||
characters, NO terminating '\0' will be written to s1. If the arrays overlap,
|
||||
behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strncpy)(char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Concatenation functions */
|
||||
|
||||
/* Append the contents of the character array s2 (including terminating '\0') to
|
||||
the character array s1 (first character of s2 overwriting the '\0' of s1). If
|
||||
the arrays overlap, behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strcat)(char* s1, const char* s2);
|
||||
|
||||
/* Append a maximum of n characters from the character array s2 to the character
|
||||
array s1 (first character of s2 overwriting the '\0' of s1). A terminating
|
||||
'\0' is ALWAYS appended, even if the full n characters have already been
|
||||
written. If the arrays overlap, behaviour is undefined.
|
||||
Returns the value of s1.
|
||||
*/
|
||||
extern char* _FUNC(strncat)(char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Comparison functions */
|
||||
|
||||
/* Compare the first n characters of the memory areas pointed to by s1 and s2.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
*/
|
||||
extern int _FUNC(memcmp)(const void* s1, const void* s2, size_t n);
|
||||
|
||||
/* Compare the character arrays s1 and s2.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
*/
|
||||
extern int _FUNC(strcmp)(const char* s1, const char* s2);
|
||||
|
||||
/* Compare the character arrays s1 and s2, interpreted as specified by the
|
||||
LC_COLLATE category of the current locale.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
TODO: Currently a dummy wrapper for strcmp() as PDCLib does not yet support
|
||||
locales.
|
||||
*/
|
||||
extern int _FUNC(strcoll)(const char* s1, const char* s2);
|
||||
|
||||
/* Compare no more than the first n characters of the character arrays s1 and
|
||||
s2.
|
||||
Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
|
||||
s1 > s2.
|
||||
*/
|
||||
extern int _FUNC(strncmp)(const char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Transform the character array s2 as appropriate for the LC_COLLATE setting of
|
||||
the current locale. If length of resulting string is less than n, store it in
|
||||
the character array pointed to by s1. Return the length of the resulting
|
||||
string.
|
||||
*/
|
||||
extern size_t _FUNC(strxfrm)(char* s1, const char* s2, size_t n);
|
||||
|
||||
/* Search functions */
|
||||
|
||||
/* Search the first n characters in the memory area pointed to by s for the
|
||||
character c (interpreted as unsigned char).
|
||||
Returns a pointer to the first instance found, or NULL.
|
||||
*/
|
||||
extern void* _FUNC(memchr)(const void* s, int c, size_t n);
|
||||
|
||||
/* Search the character array s (including terminating '\0') for the character c
|
||||
(interpreted as char).
|
||||
Returns a pointer to the first instance found, or NULL.
|
||||
*/
|
||||
extern char* _FUNC(strchr)(const char* s, int c);
|
||||
|
||||
/* Determine the length of the initial substring of character array s1 which
|
||||
consists only of characters not from the character array s2.
|
||||
Returns the length of that substring.
|
||||
*/
|
||||
extern size_t _FUNC(strcspn)(const char* s1, const char* s2);
|
||||
|
||||
/* Search the character array s1 for any character from the character array s2.
|
||||
Returns a pointer to the first occurrence, or NULL.
|
||||
*/
|
||||
extern char* _FUNC(strpbrk)(const char* s1, const char* s2);
|
||||
|
||||
/* Search the character array s (including terminating '\0') for the character c
|
||||
(interpreted as char).
|
||||
Returns a pointer to the last instance found, or NULL.
|
||||
*/
|
||||
extern char* _FUNC(strrchr)(const char* s, int c);
|
||||
|
||||
/* Determine the length of the initial substring of character array s1 which
|
||||
consists only of characters from the character array s2.
|
||||
Returns the length of that substring.
|
||||
*/
|
||||
extern size_t _FUNC(strspn)(const char* s1, const char* s2);
|
||||
|
||||
/* Search the character array s1 for the substring in character array s2.
|
||||
Returns a pointer to that sbstring, or NULL. If s2 is of length zero,
|
||||
returns s1.
|
||||
*/
|
||||
extern char* _FUNC(strstr)(const char* s1, const char* s2);
|
||||
|
||||
/* In a series of subsequent calls, parse a C string into tokens.
|
||||
On the first call to strtok(), the first argument is a pointer to the to-be-
|
||||
parsed C string. On subsequent calls, the first argument is NULL unless you
|
||||
want to start parsing a new string. s2 holds an array of separator characters
|
||||
which can differ from call to call. Leading separators are skipped, the first
|
||||
trailing separator overwritten with '\0'.
|
||||
Returns a pointer to the next token.
|
||||
WARNING: This function uses static storage, and as such is not reentrant.
|
||||
*/
|
||||
extern char* _FUNC(strtok)(char* s1, const char* s2);
|
||||
|
||||
/* Map an error number to a (locale-specific) error message string. Error
|
||||
numbers are typically errno values, but any number is mapped to a message.
|
||||
TODO: PDCLib does not yet support locales.
|
||||
*/
|
||||
extern char* _FUNC(strerror)(int errnum);
|
||||
|
||||
/* Returns the length of the string s (excluding terminating '\0').*/
|
||||
extern size_t _FUNC(strlen)(const char* s);
|
||||
|
||||
/* The function reverses the sequence of characters in the string pointed to by str. */
|
||||
extern char* _FUNC(strrev)(char* str);
|
||||
|
||||
/* The strdup function executes the function pointed to by the str argument. */
|
||||
extern char* _FUNC(strdup)(const char* str);
|
||||
|
||||
#endif
|
||||
|
@ -3,8 +3,8 @@
|
||||
#ifndef _DIRENT_H_
|
||||
#define _DIRENT_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define IS_FOLDER 16
|
||||
#define IS_FILE 0
|
||||
@ -23,7 +23,6 @@ typedef struct{
|
||||
ino_t num_objs;
|
||||
} DIR;
|
||||
|
||||
|
||||
extern int _FUNC(closedir)(DIR* dir);
|
||||
extern DIR* _FUNC(opendir)(const char* path);
|
||||
extern struct dirent* _FUNC(readdir)(DIR*);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,9 @@
|
||||
#ifndef _SOCKET_H_
|
||||
#define _SOCKET_H_
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <errno.h>
|
||||
|
||||
// Socket Types
|
||||
#define SOCK_STREAM 1
|
||||
|
@ -1,9 +0,0 @@
|
||||
format ELF
|
||||
|
||||
include '__lib__.inc'
|
||||
|
||||
section '.text'
|
||||
|
||||
public lib_name
|
||||
|
||||
lib_name db 0x55, 0xAA, lib_name_str, 0
|
@ -1,2 +0,0 @@
|
||||
lib_name equ @libc.obj
|
||||
lib_name_str equ '/sys/lib/libc.obj'
|
@ -3,7 +3,8 @@
|
||||
int a = 431;
|
||||
int b = 532;
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
assert(a != b);
|
||||
assert(a == b);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
ksys_colors_table_t sys_color_table;
|
||||
@ -10,8 +10,7 @@ char statusbar[255];
|
||||
ksys_thread_t proc_info;
|
||||
char text_line[255];
|
||||
|
||||
enum BUTTONS
|
||||
{
|
||||
enum BUTTONS {
|
||||
BTN_QUIT = 1,
|
||||
BTN_POP = 10,
|
||||
BTN_UNLOCK = 11
|
||||
@ -30,8 +29,10 @@ void draw_window()
|
||||
// define&draw window
|
||||
_ksys_create_window(10, 40, 600, 400, "My window", sys_color_table.work_area, 0x13);
|
||||
_ksys_thread_info(&proc_info, -1);
|
||||
F
|
||||
|
||||
win_width = proc_info.winx_size;
|
||||
win_width
|
||||
= proc_info.winx_size;
|
||||
win_hight = proc_info.winy_size;
|
||||
|
||||
_ksys_define_button(10, 30, 70, 20, BTN_POP, sys_color_table.work_button);
|
||||
@ -51,7 +52,8 @@ void draw_window()
|
||||
_ksys_draw_text(text_line, 5, pos_y, 0, 0x90000000 | sys_color_table.work_text);
|
||||
pos_y += FONT_H;
|
||||
|
||||
if(pos_y + 29 > win_hight) break; // 12 font + 12 statusbar + 5 border
|
||||
if (pos_y + 29 > win_hight)
|
||||
break; // 12 font + 12 statusbar + 5 border
|
||||
}
|
||||
// end redraw
|
||||
_ksys_end_draw();
|
||||
@ -69,8 +71,7 @@ int main()
|
||||
|
||||
do {
|
||||
gui_event = _ksys_get_event();
|
||||
switch(gui_event)
|
||||
{
|
||||
switch (gui_event) {
|
||||
case KSYS_EVENT_NONE:
|
||||
break;
|
||||
case KSYS_EVENT_REDRAW:
|
||||
@ -80,8 +81,7 @@ int main()
|
||||
break;
|
||||
case KSYS_EVENT_BUTTON:
|
||||
pressed_button = _ksys_get_button();
|
||||
switch (pressed_button)
|
||||
{
|
||||
switch (pressed_button) {
|
||||
case BTN_POP:
|
||||
strcpy(statusbar, "POP pressed....");
|
||||
draw_window();
|
||||
@ -102,7 +102,8 @@ int main()
|
||||
if (mouse_button & (1 << 24)) // double click
|
||||
{
|
||||
int n = (mouse_pos.y - 60) / FONT_H;
|
||||
if (n < 0 || n >= LINES) break;
|
||||
if (n < 0 || n >= LINES)
|
||||
break;
|
||||
debug_printf("click on str(%d), clip slot(%d)\n", n, LINES - n - 1);
|
||||
sprintf(statusbar, "click on str(%d), clip slot(%d)\n", n, LINES - n - 1);
|
||||
draw_window();
|
||||
|
@ -1,11 +1,11 @@
|
||||
// BOXLIB EXAMPLE (scrollbar, progressbar, editbox and checkbox)
|
||||
// Writed by maxcodehack and superturbocat2001
|
||||
|
||||
#include <sys/ksys.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <clayer/boxlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
#define WIN_W 640
|
||||
#define WIN_H 563
|
||||
@ -29,7 +29,8 @@ progressbar pg = {0, 10, 10, 270, 35, 1, 0, 200, 0xB4B4B4, 0x2728FF, 0xA9A9A9};
|
||||
edit_box ed = { WIN_W - 140, 10, 60, 0xFFFFFF, 0x6a9480, 0, 0x6a9480, BLACK | TEXT_SIZE, ED_BUFF_LEN, ed_buff, NULL, ed_focus };
|
||||
check_box output_off = { X_W(10, 15), Y_H(120, 15), 10, WHITE, BLUE, BLACK | TEXT_SIZE, "Disable duplicate output", 0 };
|
||||
|
||||
void draw_window(){
|
||||
void draw_window()
|
||||
{
|
||||
_ksys_start_draw();
|
||||
_ksys_create_window(215, 100, WIN_W, WIN_H, title, 0x858585, 0x34);
|
||||
edit_box_draw(&ed);
|
||||
@ -49,7 +50,8 @@ int main()
|
||||
while (1) {
|
||||
switch (_ksys_get_event()) {
|
||||
case KSYS_EVENT_BUTTON:
|
||||
if (_ksys_get_button() == 1) return 0;
|
||||
if (_ksys_get_button() == 1)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case KSYS_EVENT_KEY:
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <sys/ksys.h>
|
||||
#include <clayer/dialog.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* Written by turbocat2001 (Logaev Maxim) */
|
||||
|
||||
#include <clayer/libimg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <clayer/libimg.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
#define NEW_IMG_H 128
|
||||
@ -16,7 +16,8 @@ Image *image_blend; // Create image struct
|
||||
|
||||
ksys_colors_table_t sys_color_table; // Create system colors table
|
||||
|
||||
void* load_img(char* fname, uint32_t* read_sz){ // Image file upload function
|
||||
void* load_img(char* fname, uint32_t* read_sz)
|
||||
{ // Image file upload function
|
||||
FILE* f = fopen(fname, "rb");
|
||||
if (!f) {
|
||||
printf("Can't open file: %s\n", fname);
|
||||
@ -42,14 +43,16 @@ void* load_img(char* fname, uint32_t* read_sz){ // Image file upload function
|
||||
return fdata;
|
||||
}
|
||||
|
||||
void draw_gui(){
|
||||
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_end_draw();
|
||||
}
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
_ksys_get_system_colors(&sys_color_table); // Get system colors theme
|
||||
_ksys_set_event_mask(0xC0000027);
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <clayer/rasterworks.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <clayer/rasterworks.h>
|
||||
|
||||
// Sizes
|
||||
int x_size = 768, y_size = 256;
|
||||
@ -43,7 +42,8 @@ int main()
|
||||
break;
|
||||
|
||||
case KSYS_EVENT_BUTTON:
|
||||
if(_ksys_get_button() == 1) exit(0);
|
||||
if (_ksys_get_button() == 1)
|
||||
exit(0);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
@ -5,8 +5,9 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
if(con_init()) return 1; // init fail
|
||||
(*con_set_title)("Console colors");
|
||||
if (con_init())
|
||||
return 1; // init fail
|
||||
(*con_set_tsitle)("Console colors");
|
||||
|
||||
// con_write_asciiz("\033[0;31;42m test \n"); // red on green bk
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "stddef.h"
|
||||
#include <libgen.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libgen.h>
|
||||
#include <string.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
@ -12,11 +12,13 @@ enum ARGV_FILE {
|
||||
OUT = 2
|
||||
};
|
||||
|
||||
void show_help(void){
|
||||
void show_help(void)
|
||||
{
|
||||
puts("Usage: defgen [lib.obj] [lib.def]");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
if (argc != ARGC_VALID) {
|
||||
show_help();
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/dir.h>
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
#include <sys/dir.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
const char* folder_type = "Folder";
|
||||
const char* file_type = "File";
|
||||
@ -13,8 +13,7 @@ int main()
|
||||
printf("Current directory: %s\n", path);
|
||||
if (mkdir("test")) {
|
||||
puts("Test folder created!");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
puts("Error creating folder!");
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define READ_MAX 255
|
||||
|
||||
|
@ -1,14 +1,16 @@
|
||||
#include <clayer/network.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
char* host = "kolibrios.org";
|
||||
int port = 80;
|
||||
printf("Connecting to %s on port %d\n", host, port);
|
||||
struct addrinfo* addr_info;
|
||||
char port_str[16]; sprintf(port_str, "%d", port);
|
||||
char port_str[16];
|
||||
sprintf(port_str, "%d", port);
|
||||
struct addrinfo hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC; // IPv4 or IPv6 doesnt matter
|
||||
|
@ -1,15 +1,17 @@
|
||||
#include <sys/ksys.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <time.h>
|
||||
|
||||
int comp(void *a, void *b) {
|
||||
int comp(void* a, void* b)
|
||||
{
|
||||
return *(int*)a - *(int*)b;
|
||||
}
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
puts("Start testing.");
|
||||
assert(NULL == ((void*)0));
|
||||
assert(RAND_MAX == 65535);
|
||||
|
@ -1,11 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
for (i = 0; i < 20; i++) {
|
||||
printf("------------------------------------------------------\n");
|
||||
// printf ( "remainder of 5.3 / 2 is %f\n", remainder (5.3,2) );
|
||||
// printf ( "remainder of 18.5 / 4.2 is %f\n", remainder (18.5,4.2) );
|
||||
@ -38,6 +37,5 @@ int main()
|
||||
param = 50;
|
||||
result = frexp(param, &n);
|
||||
printf("%f = %f * 2^%d\n", param, result, n);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@
|
||||
* Created by turbocat (Maxim Logaev) 2022.
|
||||
*/
|
||||
|
||||
#include <sys/ksys.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
#define TH_STACK_SIZE 1024
|
||||
#define MESSAGE_SIZE 12
|
||||
@ -16,7 +16,8 @@ ksys_colors_table_t sys_colors;
|
||||
int pipefd[2];
|
||||
char* send_message = "HELLO PIPE!";
|
||||
|
||||
void tmain() {
|
||||
void tmain()
|
||||
{
|
||||
char recv_message[MESSAGE_SIZE];
|
||||
_ksys_posix_read(pipefd[0], recv_message, MESSAGE_SIZE);
|
||||
printf("RECV: %s\n", recv_message);
|
||||
@ -25,7 +26,8 @@ void tmain() {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void create_thread(void){
|
||||
void create_thread(void)
|
||||
{
|
||||
unsigned tid; // New thread ID
|
||||
void* th_stack = malloc(TH_STACK_SIZE); // Allocate memory for thread stack
|
||||
if (!th_stack) {
|
||||
@ -40,7 +42,8 @@ void create_thread(void){
|
||||
printf("New thread created (TID=%u)\n", tid);
|
||||
}
|
||||
|
||||
void main() {
|
||||
void main()
|
||||
{
|
||||
if (_ksys_posix_pipe2(pipefd, 0)) {
|
||||
puts("Pipe creation error!");
|
||||
return;
|
||||
|
@ -17,30 +17,27 @@ void setpixel(SDL_Surface *screen, int x, int y, Uint8 r, Uint8 g, Uint8 b)
|
||||
*pixmem32 = colour;
|
||||
}
|
||||
|
||||
|
||||
void DrawScreen(SDL_Surface* screen, int h)
|
||||
{
|
||||
int x, y, ytimesw;
|
||||
|
||||
if(SDL_MUSTLOCK(screen))
|
||||
{
|
||||
if(SDL_LockSurface(screen) < 0) return;
|
||||
if (SDL_MUSTLOCK(screen)) {
|
||||
if (SDL_LockSurface(screen) < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
for(y = 0; y < screen->h; y++ )
|
||||
{
|
||||
for (y = 0; y < screen->h; y++) {
|
||||
ytimesw = y * screen->pitch / BPP;
|
||||
for( x = 0; x < screen->w; x++ )
|
||||
{
|
||||
for (x = 0; x < screen->w; x++) {
|
||||
setpixel(screen, x, ytimesw, (x * x) / 256 + 3 * y + h, (y * y) / 256 + x + h, h);
|
||||
}
|
||||
}
|
||||
if(SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);
|
||||
if (SDL_MUSTLOCK(screen))
|
||||
SDL_UnlockSurface(screen);
|
||||
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
SDL_Surface* screen;
|
||||
@ -49,21 +46,18 @@ int main(int argc, char* argv[])
|
||||
int keypress = 0;
|
||||
int h = 0;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
return 1;
|
||||
|
||||
if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_FULLSCREEN|SDL_HWSURFACE)))
|
||||
{
|
||||
if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_FULLSCREEN | SDL_HWSURFACE))) {
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
while(!keypress)
|
||||
{
|
||||
while (!keypress) {
|
||||
DrawScreen(screen, h++);
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
switch (event.type)
|
||||
{
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
keypress = 1;
|
||||
break;
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
char string[256];
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
shell_cls();
|
||||
shell_printf("SHELL PID=%d\n\r", shell_get_pid());
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
#include <sys/ksys.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
char* test_string1 = "Hello world!";
|
||||
int a, b;
|
||||
|
||||
int main(int argc, char** argv){
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
sscanf("43 53", "%d %d", &a, &b);
|
||||
printf("(43 53) = (%d %d)\n", a, b);
|
||||
printf("Hello world! = %s\n", test_string1);
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
int main(int argc, char** argv){
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char hello1[] = "Hello, KolibriOS!";
|
||||
char hello2[20];
|
||||
memcpy(hello1, hello2, strlen(hello1));
|
||||
|
@ -5,9 +5,9 @@
|
||||
* Created by turbocat (Maxim Logaev) 2021.
|
||||
*/
|
||||
|
||||
#include <sys/ksys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
#define TH_STACK_SIZE 1024
|
||||
|
||||
@ -20,7 +20,8 @@ ksys_colors_table_t sys_colors;
|
||||
|
||||
extern int main();
|
||||
|
||||
void redraw_window(void){
|
||||
void redraw_window(void)
|
||||
{
|
||||
ksys_pos_t mouse_pos = _ksys_get_mouse_pos(KSYS_MOUSE_SCREEN_POS);
|
||||
_ksys_start_draw();
|
||||
_ksys_create_window(mouse_pos.x, mouse_pos.y, 140, 60, "Threads", sys_colors.work_area, 0x14);
|
||||
@ -29,7 +30,8 @@ void redraw_window(void){
|
||||
_ksys_end_draw();
|
||||
}
|
||||
|
||||
void create_thread(void){
|
||||
void create_thread(void)
|
||||
{
|
||||
unsigned tid; // New thread ID
|
||||
void* th_stack = malloc(TH_STACK_SIZE); // Allocate memory for thread stack
|
||||
if (!th_stack) {
|
||||
@ -44,7 +46,8 @@ void create_thread(void){
|
||||
debug_printf("New thread created (TID=%u)\n", tid);
|
||||
}
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
_ksys_get_system_colors(&sys_colors);
|
||||
int gui_event;
|
||||
redraw_window();
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "stddef.h"
|
||||
#include <sys/ksys.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
#define DEV_ADD_DISK 1
|
||||
|
||||
@ -22,10 +22,11 @@ char *tmpdisk_res_text[]={
|
||||
"DiskSize is too small, might be too little free RAM",
|
||||
"Memory allocation failed",
|
||||
"Unknown error O_o",
|
||||
0};
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
ksys_drv_hand_t tmpdisk_drv = _ksys_load_driver("tmpdisk");
|
||||
if (!tmpdisk_drv) {
|
||||
puts("tmpdisk.sys driver not load!");
|
||||
|
@ -4,14 +4,14 @@ The main code is taken from the site:
|
||||
https://www.binarytides.com/whois-client-code-in-c-with-linux-sockets/
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "sys/ksys.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <clayer/network.h>
|
||||
#include <conio.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
FILE* out = stdout;
|
||||
|
||||
@ -38,7 +38,6 @@ int whois_query(char * , char * , char **);
|
||||
char* str_replace(char* search, char* replace, char* subject);
|
||||
char* str_copy(char*);
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char *domain, *data = NULL;
|
||||
@ -231,7 +230,8 @@ int whois_query(char *server , char *query , char **response)
|
||||
int hostname_to_ip(char* hostname, char* ip)
|
||||
{
|
||||
struct addrinfo* addr_info;
|
||||
char port_str[16]; sprintf(port_str, "%d", 80);
|
||||
char port_str[16];
|
||||
sprintf(port_str, "%d", 80);
|
||||
struct addrinfo hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC; // IPv4 or IPv6 doesnt matter
|
||||
|
Loading…
Reference in New Issue
Block a user