kolibri-libc:

- Fix fputs and fgets  fs error names(added KSYS prefix instead KOS)
- Added enum KSYS_MOUSE_POS

git-svn-id: svn://kolibrios.org@8628 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-03-02 21:28:51 +00:00
parent b3dd287ea0
commit 7d923337f0
4 changed files with 43 additions and 38 deletions

View File

@ -97,7 +97,7 @@ int main()
}
break;
case KSYS_EVENT_MOUSE:
mouse_pos = _ksys_get_mouse_pos(0); // window relative
mouse_pos = _ksys_get_mouse_pos(KSYS_MOUSE_WINDOW_POS); // window relative
mouse_button = _ksys_get_mouse_eventstate();
debug_printf("mouse ev (%d,%d)%x\n", mouse_pos.x, mouse_pos.y, mouse_button);
if (mouse_button & (1<<24)) // double click

View File

@ -10,18 +10,18 @@ extern "C" {
#define asm_inline __asm__ __volatile__
#define not_optimized __attribute__((optimize("O0")))
#define _KOS_FS_ERR_SUCCESS 0 // Success
#define _KOS_FS_ERR_1 1 // Base and/or partition of a hard disk is not defined (fn21.7 & fn21.8)
#define _KOS_FS_ERR_2 2 // Function is not supported for the given file system
#define _KOS_FS_ERR_3 3 // Unknown file system
#define _KOS_FS_ERR_4 4 // Reserved, is never returned in the current implementation
#define _KOS_FS_ERR_5 5 // File not found
#define _KOS_FS_ERR_EOF 6 // End of file, EOF
#define _KOS_FS_ERR_7 7 // Pointer lies outside of application memory
#define _KOS_FS_ERR_8 8 // Disk is full
#define _KOS_FS_ERR_9 9 // FAT table is destroyed
#define _KOS_FS_ERR_10 10 // Access denied
#define _KOS_FS_ERR_11 11 // Device error
#define KSYS_FS_ERR_SUCCESS 0 // Success
#define KSYS_FS_ERR_1 1 // Base and/or partition of a hard disk is not defined (fn21.7 & fn21.8)
#define KSYS_FS_ERR_2 2 // Function is not supported for the given file system
#define KSYS_FS_ERR_3 3 // Unknown file system
#define KSYS_FS_ERR_4 4 // Reserved, is never returned in the current implementation
#define KSYS_FS_ERR_5 5 // File not found
#define KSYS_FS_ERR_EOF 6 // End of file, EOF
#define KSYS_FS_ERR_7 7 // Pointer lies outside of application memory
#define KSYS_FS_ERR_8 8 // Disk is full
#define KSYS_FS_ERR_9 9 // FAT table is destroyed
#define KSYS_FS_ERR_10 10 // Access denied
#define KSYS_FS_ERR_11 11 // Device error
typedef struct {
unsigned char blue;
@ -61,7 +61,7 @@ typedef struct{
size_t size;
}ksys_ufile_t;
typedef struct{
unsigned p00;
union{
@ -184,6 +184,11 @@ enum KSYS_CLIP_TYPES{
KSYS_CLIP_RAW = 2
};
enum KSYS_MOUSE_POS{
KSYS_MOUSE_SCREEN_POS = 0,
KSYS_MOUSE_WINDOW_POS = 1
};
static inline
int _ksys_strcmp(const char * s1, const char * s2 )
{

View File

@ -9,21 +9,21 @@ int fgetc(FILE* stream)
unsigned status = _ksys_file_read_file(stream->name, stream->position, 1, &c, &bytes_read);
if (status != _KOS_FS_ERR_SUCCESS) {
if (status != KSYS_FS_ERR_SUCCESS) {
switch (status) {
case _KOS_FS_ERR_EOF:
case KSYS_FS_ERR_EOF:
stream->eof = 1;
break;
case _KOS_FS_ERR_1:
case _KOS_FS_ERR_2:
case _KOS_FS_ERR_3:
case _KOS_FS_ERR_4:
case _KOS_FS_ERR_5:
case _KOS_FS_ERR_7:
case _KOS_FS_ERR_8:
case _KOS_FS_ERR_9:
case _KOS_FS_ERR_10:
case _KOS_FS_ERR_11:
case KSYS_FS_ERR_1:
case KSYS_FS_ERR_2:
case KSYS_FS_ERR_3:
case KSYS_FS_ERR_4:
case KSYS_FS_ERR_5:
case KSYS_FS_ERR_7:
case KSYS_FS_ERR_8:
case KSYS_FS_ERR_9:
case KSYS_FS_ERR_10:
case KSYS_FS_ERR_11:
default:
// Just some IO error, who knows what exactly happened
errno = EIO;

View File

@ -8,19 +8,19 @@ int fputc(int c, FILE *stream)
unsigned status = _ksys_file_write_file(stream->name, stream->position, 1, &c, &bytes_written);
if (status != _KOS_FS_ERR_SUCCESS) {
if (status != KSYS_FS_ERR_SUCCESS) {
switch (status) {
case _KOS_FS_ERR_1:
case _KOS_FS_ERR_2:
case _KOS_FS_ERR_3:
case _KOS_FS_ERR_4:
case _KOS_FS_ERR_5:
case _KOS_FS_ERR_EOF:
case _KOS_FS_ERR_7:
case _KOS_FS_ERR_8:
case _KOS_FS_ERR_9:
case _KOS_FS_ERR_10:
case _KOS_FS_ERR_11:
case KSYS_FS_ERR_1:
case KSYS_FS_ERR_2:
case KSYS_FS_ERR_3:
case KSYS_FS_ERR_4:
case KSYS_FS_ERR_5:
case KSYS_FS_ERR_EOF:
case KSYS_FS_ERR_7:
case KSYS_FS_ERR_8:
case KSYS_FS_ERR_9:
case KSYS_FS_ERR_10:
case KSYS_FS_ERR_11:
default:
// Just some IO error, who knows what exactly happened
errno = EIO;