Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8611 → Rev 8610

/contrib/sdk/sources/newlib/libc/include/sys/kos.h
1,18 → 1,15
////////////////////////////////////////////
// Copyright (C) 2021 maxcodehack, GPLv2 //
// KolibriOS Syscalls //
// sys/kos.h //
// Based on kos32sys and other wrappers //
// //
// Syscalls scheme: kos_XxxYyy //
// (e.g. kos_DrawWindow) //
////////////////////////////////////////////
 
// Some code was written by maxcodehack
 
#include <stdint.h>
#include <string.h>
 
/*********************** Types *************************/
typedef unsigned int color_t;
 
// Struct for App running
68,7 → 65,7
};
#pragma pack(pop)
 
// Color struct for sysfn 48
// Color struct for sysfn ?
struct kolibri_system_colors {
color_t frame_area;
color_t grab_bar;
93,7 → 90,7
} pos_t;
 
 
/*********************** Window Syscalls *************************/
/// Window Syscalls:
// Start drawing
static inline void kos_BeginDraw(void)
{
122,23 → 119,6
"S"(0) : "memory");
};
 
// Set window layer behaviour
#define ZPOS_DESKTOP -2
#define ZPOS_ALWAYS_BACK -1
#define ZPOS_NORMAL 0
#define ZPOS_ALWAYS_TOP 1
 
static inline void kos_SetWindowLayerBehaviour(int zpos)
{
__asm__ __volatile__(
"int $0x40"
::"a"(18),
"b"(25),
"c"(2),
"d"(-1),
"S"(zpos) : "memory");
};
 
// Change window size
#define OLD -1
static inline void kos_ChangeWindow(int new_x, int new_y, int new_w, int new_h)
149,7 → 129,7
);
}
 
/*********************** Other GUI functions *************************/
/// Other GUI functions:
// Draw text
static inline void kos_DrawText(int x, int y, const char *text, color_t color)
{
223,41 → 203,8
"d"((x << 16) | y));
}
 
// Blitter
static inline void Blit(void *bitmap, int dst_x, int dst_y,
int src_x, int src_y, int w, int h,
int src_w, int src_h, int stride)
{
volatile struct blit_call bc;
 
bc.dstx = dst_x;
bc.dsty = dst_y;
bc.w = w;
bc.h = h;
bc.srcx = src_x;
bc.srcy = src_y;
bc.srcw = src_w;
bc.srch = src_h;
bc.stride = stride;
bc.bitmap = bitmap;
 
__asm__ __volatile__(
"int $0x40"
::"a"(73),"b"(0),"c"(&bc.dstx));
};
 
// Get screen part as image
static inline void kos_ScreenShot(char* image, int x, int y, int w, int h)
{
__asm__ __volatile__(
"int $0x40"
::"a"(36),
"b"(image),
"c"(w*65536+h),
"d"(x*65536+y) : "memory");
};
 
/*********************** Skin *************************/
/// Skin:
// Return skin height
static inline uint32_t kos_SkinHeight(void)
{
270,7 → 217,7
return height;
};
 
/*********************** Mouse *************************/
/// Mouse:
// Get mouse position
#define POS_SCREEN 0
#define POS_WINDOW 1
348,7 → 295,7
return ret;
};
 
/*********************** OS Events *************************/
/// OS Events:
#define evReDraw 1
#define evKey 2
#define evButton 3
390,7 → 337,7
return val;
};
 
/*********************** Eventmask *************************/
/// Eventmask:
#define EVM_REDRAW 1
#define EVM_KEY 2
#define EVM_BUTTON 4
415,7 → 362,7
return old_event_mask;
};
 
/*********************** Other *************************/
/// Other:
// Get key
int kos_GetKey()
{
477,6 → 424,29
:"memory");
};
 
// Blitter
static inline void Blit(void *bitmap, int dst_x, int dst_y,
int src_x, int src_y, int w, int h,
int src_w, int src_h, int stride)
{
volatile struct blit_call bc;
bc.dstx = dst_x;
bc.dsty = dst_y;
bc.w = w;
bc.h = h;
bc.srcx = src_x;
bc.srcy = src_y;
bc.srcw = src_w;
bc.srch = src_h;
bc.stride = stride;
bc.bitmap = bitmap;
__asm__ __volatile__(
"int $0x40"
::"a"(73),"b"(0),"c"(&bc.dstx));
};
 
void kos_RunApp(char* app, char* param)
{
kos_Struct70 r;