ktcc: Delete old libc sources
git-svn-id: svn://kolibrios.org@9547 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a3a9827bf6
commit
e0e11ba32b
@ -1,292 +0,0 @@
|
|||||||
|
|
||||||
; KolibriOS system functions:
|
|
||||||
+SF_TERMINATE_PROCESS=-1 // kos_exit()
|
|
||||||
+SF_CREATE_WINDOW=0 ; define and draw the window //sys_create_window()
|
|
||||||
SF_PUT_PIXEL=1 ; draw pixel to the window
|
|
||||||
+SF_GET_KEY=2 ; get code of the pressed key
|
|
||||||
SF_GET_SYS_TIME=3
|
|
||||||
+SF_DRAW_TEXT=4 //draw_text_sys()
|
|
||||||
+SF_SLEEP=5 ; pause process // delay()
|
|
||||||
+SF_PUT_IMAGE=7 ; draw image to the window //draw_bitmap()
|
|
||||||
+SF_DEFINE_BUTTON=8 ; define/delete the button
|
|
||||||
+SF_THREAD_INFO=9 ; information on execution thread // get_proc_info()
|
|
||||||
+SF_WAIT_EVENT=10 ; wait for event // get_os_event()
|
|
||||||
+SF_CHECK_EVENT=11 ; check for event and return // check_os_event()
|
|
||||||
SF_REDRAW=12
|
|
||||||
+ SSF_BEGIN_DRAW=1
|
|
||||||
+ SSF_END_DRAW=2
|
|
||||||
+SF_DRAW_RECT=13 ; draw rectangle to the window // draw_bar()
|
|
||||||
SF_GET_SCREEN_SIZE=14 ; get screen resolution
|
|
||||||
SF_BACKGROUND_SET=15
|
|
||||||
SSF_SIZE_BG=1
|
|
||||||
SSF_PIXEL_BG=2
|
|
||||||
SSF_REDRAW_BG=3
|
|
||||||
SSF_MODE_BG=4
|
|
||||||
SSF_IMAGE_BG=5
|
|
||||||
SSF_MAP_BG=6 ; map background image to the address space of the process
|
|
||||||
SSF_UNMAP_BG=7
|
|
||||||
SSF_LAST_DRAW=8 ; get coordinates of the last draw to the background
|
|
||||||
SSF_REDRAW_RECT=9 ; redraws a rectangular part of the background
|
|
||||||
SF_RD_TO_FLOPPY=16 ; save ramdisk on the floppy
|
|
||||||
+SF_GET_BUTTON=17 ; get ID of the pressed button // get_os_button()
|
|
||||||
SF_SYSTEM=18
|
|
||||||
SSF_UNFOCUS_WINDOW=1 ; take focus from the window of the given thread
|
|
||||||
SSF_TERMINATE_THREAD=2 ; terminate process/thread by the slot number
|
|
||||||
+ SSF_FOCUS_WINDOW=3 ; give focus to the window of the given thread
|
|
||||||
SSF_GET_IDLE_COUNT=4 ; get counter of idle cycles per second
|
|
||||||
SSF_GET_CPU_REQUENCY=5 ; get CPU clock rate
|
|
||||||
SSF_RD_TO_HDD=6 ; save ramdisk to the file on hard disk
|
|
||||||
SSF_GET_ACTIVE_WINDOW=7 ; get slot number of the active window
|
|
||||||
SSF_SPEAKER=8
|
|
||||||
SSSF_GET_STATE=1
|
|
||||||
SSSF_TOGGLE=2
|
|
||||||
SSF_SHUTDOWN=9 ; system shutdown/reboot
|
|
||||||
SSF_MINIMIZE_WINDOW=10 ; minimize active window
|
|
||||||
SSF_INFO_DISC_SYS=11 ; get disk subsystem information
|
|
||||||
SSF_KERNEL_VERSION=13 ; get kernel version
|
|
||||||
SSF_WAIT_RETRACE=14 ; wait for screen retrace
|
|
||||||
SSF_CURSOR_CENTER=15 ; center mouse cursor on the screen
|
|
||||||
SSF_GET_FREE_RAM=16 ; get size of free RAM
|
|
||||||
SSF_GET_TOTAL_RAM=17 ; get total amount of RAM
|
|
||||||
SSF_TERMINATE_THREAD_ID=18 ; Terminate process/thread by the ID
|
|
||||||
SSF_MOUSE_SETTINGS=19
|
|
||||||
SSSF_GET_SPEED=0
|
|
||||||
SSSF_SET_SPEED=1
|
|
||||||
SSSF_GET_SPEEDUP=2
|
|
||||||
SSSF_SET_SPEEDUP=3 ; set mouse acceleration
|
|
||||||
SSSF_SET_POS=4 ; set mouse pointer position
|
|
||||||
SSSF_SET_BUTTON=5 ; simulate state of mouse buttons
|
|
||||||
SSSF_GET_DOUBLE_CLICK_DELAY=6
|
|
||||||
SSSF_SET_DOUBLE_CLICK_DELAY=7
|
|
||||||
SSF_GET_RAM_INFO=20 ; get information on RAM
|
|
||||||
+ SSF_GET_THREAD_SLOT=21 ; get slot number of process/thread by the ID
|
|
||||||
SSF_FOREIGN_WINDOW=22 ; operations with window of another thread by slot/ID
|
|
||||||
SSSF_MINIMIZE=0
|
|
||||||
SSSF_MINIMIZE_ID=1
|
|
||||||
SSSF_RESTORE=2
|
|
||||||
SSSF_RESTORE_ID=3
|
|
||||||
SSF_MINIMIZE_ALL=23
|
|
||||||
SSF_SET_SCREEN_LIMITS=24
|
|
||||||
SSF_WINDOW_BEHAVIOR=25 ; window focus relation with other windows
|
|
||||||
SSSF_GET_WB=1
|
|
||||||
SSSF_SET_WB=2
|
|
||||||
SF_MIDI=20
|
|
||||||
SSF_RESET=1
|
|
||||||
SSF_OUTPUT=2
|
|
||||||
SF_SYSTEM_SET=21
|
|
||||||
SSF_MPU_MIDI_BASE=1
|
|
||||||
SSF_KEYBOARD_LAYOUT=2
|
|
||||||
SSF_SYS_LANG=5
|
|
||||||
SSF_ACCESS_HD_LBA=11 ; setting of low-level access to HD
|
|
||||||
SSF_ACCESS_PCI=12 ; setting of low-level access to PCI
|
|
||||||
SF_SET_TIME_DATE=22
|
|
||||||
+SF_WAIT_EVENT_TIMEOUT=23; wait for event with timeout // wait_for_event()
|
|
||||||
SF_CD=24
|
|
||||||
SSF_EJECT_TRAY=4
|
|
||||||
SSF_INSERT_TRAY=5
|
|
||||||
SF_SCREEN_PUT_IMAGE=25 ; put image on the background layer
|
|
||||||
SF_SYSTEM_GET=26
|
|
||||||
; Same as SF_SYSTEM_SET, plus:
|
|
||||||
+ SSF_TIME_COUNT=9 // get_tick_count()
|
|
||||||
+ SSF_TIME_COUNT_PRO=10 ; get value of the high precision time counter // get_ns_count()
|
|
||||||
SF_GET_SYS_DATE=29
|
|
||||||
SF_CURRENT_FOLDER=30
|
|
||||||
+ SSF_SET_CF=1 ; set current folder for the thread // set_current_folder()
|
|
||||||
+ SSF_GET_CF=2 // get_current_folder()
|
|
||||||
SSF_ADD_SYS_FOLDER=3 ; install the add.system directory for the kernel
|
|
||||||
SF_GET_PIXEL_OWNER=34 ; get slot number of the screen pixel owner
|
|
||||||
SF_GET_PIXEL=35 ; read the screen pixel color
|
|
||||||
SF_GET_IMAGE=36 ; read the screen area
|
|
||||||
SF_MOUSE_GET=37
|
|
||||||
+ SSF_SCREEN_POSITION=0 // get_mouse_pos(POS_SCREEN)
|
|
||||||
+ SSF_WINDOW_POSITION=1 // get_mouse_pos(POS_WINDOW)
|
|
||||||
+ SSF_BUTTON=2 ; states of the mouse buttons //get_mouse_buttons()
|
|
||||||
+ SSF_BUTTON_EXT=3 ; states and events of the mouse buttons // get_mouse_eventstate()
|
|
||||||
+ SSF_LOAD_CURSOR=4
|
|
||||||
+ SSF_SET_CURSOR=5
|
|
||||||
+ SSF_DEL_CURSOR=6 // destroy_cursor()
|
|
||||||
+ SSF_SCROLL_DATA=7 //get_mouse_wheels()
|
|
||||||
+SF_DRAW_LINE=38
|
|
||||||
SF_BACKGROUND_GET=39
|
|
||||||
;SSF_SIZE_BG=1
|
|
||||||
;SSF_PIXEL_BG=2
|
|
||||||
;SSF_MODE_BG=4
|
|
||||||
+SF_SET_EVENTS_MASK=40 ; turn on/off desired events
|
|
||||||
SF_PORT_IN_OUT=43 ; input/output to a port
|
|
||||||
SF_SET_PORTS=46 ; reserve/free a group of input/output ports
|
|
||||||
+SF_DRAW_NUMBER=47 ; draw number to the window // draw_number_sys()
|
|
||||||
SF_STYLE_SETTINGS=48
|
|
||||||
SSF_APPLY=0 ; apply screen settings
|
|
||||||
SSF_SET_BUTTON_STYLE=1
|
|
||||||
SSF_SET_COLORS=2
|
|
||||||
+ SSF_GET_COLORS=3 ; get standard window colors // get_system_colors()
|
|
||||||
+ SSF_GET_SKIN_HEIGHT=4
|
|
||||||
SSF_GET_SCREEN_AREA=5 ; get screen working area
|
|
||||||
SSF_SET_SCREEN_AREA=6
|
|
||||||
SSF_GET_SKIN_MARGINS=7
|
|
||||||
SSF_SET_SKIN=8
|
|
||||||
SSF_GET_FONT_SMOOTH=9
|
|
||||||
SSF_SET_FONT_SMOOTH=10
|
|
||||||
SSF_GET_FONT_SIZE=11
|
|
||||||
SSF_SET_FONT_SIZE=12
|
|
||||||
SF_APM=49
|
|
||||||
SF_SET_WINDOW_SHAPE=50
|
|
||||||
+SF_CREATE_THREAD=51 // start_thread()
|
|
||||||
SF_CLIPBOARD=54
|
|
||||||
+ SSF_GET_SLOT_COUNT=0 ; get the number of slots in the clipboard // kol_clip_num()
|
|
||||||
+ SSF_READ_CB=1 // kol_clip_get()
|
|
||||||
+ SSF_WRITE_CB=2 // kol_clip_set()
|
|
||||||
+ SSF_DEL_SLOT=3 ; delete the last slot in the clipboard // kol_clip_pop()
|
|
||||||
+ SSF_UNLOCK_BUFFER=4 ; emergency buffer unlock // kol_clip_unlock()
|
|
||||||
SF_SPEAKER_PLAY=55
|
|
||||||
SF_PCI_BIOS=57
|
|
||||||
SF_IPC=60 ; Inter Process Communication
|
|
||||||
+ SSF_SET_AREA=1 ; set area for IPC receiving // ipc_set_area()
|
|
||||||
+ SSF_SEND_MESSAGE=2 // ipc_send_message()
|
|
||||||
SF_GET_GRAPHICAL_PARAMS=61
|
|
||||||
+ SSF_SCREEN_SIZE=1 // GetScreenSize()
|
|
||||||
SSF_BITS_PER_PIXEL=2
|
|
||||||
SSF_BYTES_PER_LINE=3
|
|
||||||
SF_PCI=62
|
|
||||||
SSF_GET_VERSION=0 ; get version of PCI-interface
|
|
||||||
SSF_GET_LAST_BUS=1 ; get number of the last PCI-bus
|
|
||||||
SSF_GET_ADRR_MODE=2 ; get addressing mode of the PCI configuration space
|
|
||||||
SSF_READ_BYTE=4
|
|
||||||
SSF_READ_WORD=5
|
|
||||||
SSF_READ_DWORD=6
|
|
||||||
SSF_WRITE_BYTE=8
|
|
||||||
SSF_WRITE_WORD=9
|
|
||||||
SSF_WRITE_DWORD=10
|
|
||||||
SF_BOARD=63
|
|
||||||
+ SSF_DEBUG_WRITE=1 // debug_board_write_byte()
|
|
||||||
SSF_DEBUG_READ=2
|
|
||||||
SF_MEMORY_RESIZE=64 ; resize total application memory
|
|
||||||
SF_PUT_IMAGE_EXT=65 ; draw image with palette to the window
|
|
||||||
SF_KEYBOARD=66
|
|
||||||
SSF_SET_INPUT_MODE=1
|
|
||||||
SSF_GET_INPUT_MODE=2
|
|
||||||
SSF_GET_CONTROL_KEYS=3; get status of control keys
|
|
||||||
SSF_SET_SYS_HOTKEY=4
|
|
||||||
SSF_DEL_SYS_HOTKEY=5
|
|
||||||
SSF_LOCK_INPUT=6 ; block normal input
|
|
||||||
SSF_UNLOCK_INPUT=7 ; restore normal input
|
|
||||||
SF_CHANGE_WINDOW=67 ; change position/sizes of the window
|
|
||||||
SF_SYS_MISC=68
|
|
||||||
SSF_GET_TASK_SWITCH_COUNT=0
|
|
||||||
+ SSF_SWITCH_TASK=1 //yield()
|
|
||||||
SSF_PERFORMANCE=2
|
|
||||||
SSSF_ALLOW_RDPMC=0
|
|
||||||
SSSF_CACHE_STATUS=1
|
|
||||||
SSSF_CACHE_ON=2
|
|
||||||
SSSF_CACHE_OFF=3
|
|
||||||
SSF_READ_MSR=3
|
|
||||||
SSF_WRITE_MSR=4
|
|
||||||
SSF_HEAP_INIT=11
|
|
||||||
+ SSF_MEM_ALLOC=12 // user_alloc()
|
|
||||||
+ SSF_MEM_FREE=13 // user_free()
|
|
||||||
SSF_WAIT_SIGNAL=14 ; wait for signal from another program/driver
|
|
||||||
+ SSF_LOAD_DRIVER=16 // get_service()
|
|
||||||
+ SSF_CONTROL_DRIVER=17 // call_service()
|
|
||||||
SSF_LOAD_DLL=19
|
|
||||||
+ SSF_MEM_REALLOC=20 //user_realloc()
|
|
||||||
SSF_LOAD_DRIVER_PE=21
|
|
||||||
+ SSF_MEM_OPEN=22 ; open named memory area // shm_open()
|
|
||||||
+ SSF_MEM_CLOSE=23 // shm_close()
|
|
||||||
SSF_SET_EXCEPTION_HANDLER=24
|
|
||||||
SSF_SET_EXCEPTION_STATE=25
|
|
||||||
+ SSF_MEM_FREE_EXT=26 // user_unmap()
|
|
||||||
+ SSF_LOAD_FILE=27
|
|
||||||
SF_DEBUG=69
|
|
||||||
SSF_SET_MESSAGE_AREA=0
|
|
||||||
SSF_GET_REGISTERS=1
|
|
||||||
SSF_SET_REGISTERS=2
|
|
||||||
SSF_DETACH=3
|
|
||||||
SSF_SUSPEND=4
|
|
||||||
SSF_RESUME=5
|
|
||||||
SSF_READ_MEMORY=6
|
|
||||||
SSF_WRITE_MEMORY=7
|
|
||||||
SSF_TERMINATE=8
|
|
||||||
SSF_DEFINE_BREAKPOINT=9
|
|
||||||
SF_FILE=70
|
|
||||||
SSF_READ_FILE=0
|
|
||||||
SSF_READ_FOLDER=1
|
|
||||||
SSF_CREATE_FILE=2
|
|
||||||
SSF_WRITE_FILE=3
|
|
||||||
SSF_SET_END=4
|
|
||||||
SSF_GET_INFO=5
|
|
||||||
SSF_SET_INFO=6
|
|
||||||
+ SSF_START_APP=7
|
|
||||||
SSF_DELETE=8
|
|
||||||
SSF_CREATE_FOLDER=9
|
|
||||||
SF_SET_CAPTION=71
|
|
||||||
SF_SEND_MESSAGE=72
|
|
||||||
+SF_BLITTER=73 //Blit()
|
|
||||||
SF_NETWORK_GET=74
|
|
||||||
SSF_DEVICE_COUNT=255 ; get number of active network devices
|
|
||||||
SSF_DEVICE_TYPE=0
|
|
||||||
SSF_DEVICE_NAME=1
|
|
||||||
SSF_RESET_DEVICE=2
|
|
||||||
SSF_STOP_DEVICE=3
|
|
||||||
SSF_DEVICE_POINER=4
|
|
||||||
SSF_TX_PACKET_COUNT=6
|
|
||||||
SSF_RX_PACKET_COUNT=7
|
|
||||||
SSF_TX_BYTE_COUNT=8
|
|
||||||
SSF_RX_BYTE_COUNT=9
|
|
||||||
SSF_LINK_STATUS=10
|
|
||||||
SF_NETWORK_SOCKET=75
|
|
||||||
SSF_OPEN=0
|
|
||||||
SSF_CLOSE=1
|
|
||||||
SSF_BIND=2
|
|
||||||
SSF_LISTEN=3
|
|
||||||
SSF_CONNECT=4
|
|
||||||
SSF_ACCEPT=5
|
|
||||||
SSF_SEND=6
|
|
||||||
SSF_RECEIVE=7
|
|
||||||
SSF_SET_OPTIONS=8
|
|
||||||
SSF_GET_OPTIONS=9
|
|
||||||
SSF_GET_PAIR=10
|
|
||||||
SF_NETWORK_PROTOCOL=76
|
|
||||||
SSF_ETHERNET_READ_MAC=0
|
|
||||||
SSF_IP4_PACKETS_SENT=10000h
|
|
||||||
SSF_IP4_PACKETS_RECEIVED=10001h
|
|
||||||
SSF_IP4_READ_IP=10002h
|
|
||||||
SSF_IP4_WRITE_IP=10003h
|
|
||||||
SSF_IP4_READ_DNS=10004h
|
|
||||||
SSF_IP4_WRITE_DNS=10005h
|
|
||||||
SSF_IP4_READ_SUBNET=10006h
|
|
||||||
SSF_IP4_WRITE_SUBNET=10007h
|
|
||||||
SSF_IP4_READ_GATEWAY=10008h
|
|
||||||
SSF_IP4_WRITE_GATEWAY=10009h
|
|
||||||
SSF_ICMP_PACKETS_SENT=20000h
|
|
||||||
SSF_ICMP_PACKETS_RECEIVED=20001h
|
|
||||||
SSF_ICMP_ECHO_REPLY=20003h
|
|
||||||
SSF_UDP_PACKETS_SENT=30000h
|
|
||||||
SSF_UDP_PACKETS_RECEIVED=30001h
|
|
||||||
SSF_TCP_PACKETS_SENT=40000h
|
|
||||||
SSF_TCP_PACKETS_RECEIVED=40001h
|
|
||||||
SSF_ARP_PACKETS_SENT=50000h
|
|
||||||
SSF_ARP_PACKETS_RECEIVED=50001h
|
|
||||||
SSF_ARP_GET_ENTRY_COUNT=50002h
|
|
||||||
SSF_ARP_READ_ENTRY=50003h
|
|
||||||
SSF_ARP_ADD_STATIC_ENTRY=50004h
|
|
||||||
SSF_ARP_DEL_ENTRY=50005h
|
|
||||||
SSF_ARP_SEND_ANNOUNCE=50006h
|
|
||||||
SSF_ARP_CONFLICTS_COUNT=50007h
|
|
||||||
SF_FUTEX=77
|
|
||||||
SSF_CREATE=0
|
|
||||||
SSF_DESTROY=1
|
|
||||||
SSF_WAIT=2
|
|
||||||
SSF_WAKE=3
|
|
||||||
|
|
||||||
; File system errors:
|
|
||||||
FSERR_SUCCESS=0
|
|
||||||
FSERR_UNSUPPORTED=2
|
|
||||||
FSERR_UNKNOWN=3
|
|
||||||
FSERR_FILE_NOT_FOUND=5
|
|
||||||
FSERR_END_OF_FILE=6
|
|
||||||
FSERR_INVALID_BUFFER=7
|
|
||||||
FSERR_DISK_FULL=8
|
|
||||||
FSERR_FAIL=9
|
|
||||||
FSERR_ACCESS_DENIED=10
|
|
||||||
FSERR_DEVICE_FAIL=11
|
|
||||||
FSERR_OUT_OF_MEMORY=12
|
|
@ -1,33 +0,0 @@
|
|||||||
INCLUDE = include
|
|
||||||
LIBSFORBUILD = math
|
|
||||||
LIBNAME = libck.a
|
|
||||||
CC = ../bin/kos32-tcc
|
|
||||||
CFLAGS = -I$(INCLUDE) -m32 -nostdinc -nostdlib -DGNUC
|
|
||||||
DIRS := stdio memory kolibrisys string stdlib math dlfcn libgen fs net
|
|
||||||
|
|
||||||
##############################################################
|
|
||||||
#files := $(foreach dir,$(DIRS),$(dir)/$(wildcard $(dir)/*))
|
|
||||||
asmfiles := $(foreach dir,$(DIRS),$(patsubst %.asm, %.o, $(wildcard $(dir)/*.asm)))
|
|
||||||
cfiles := $(foreach dir,$(DIRS),$(patsubst %.c, %.o, $(wildcard $(dir)/*.c)))
|
|
||||||
|
|
||||||
.PHONY: clean all
|
|
||||||
|
|
||||||
ifdef windir
|
|
||||||
doClean = del /F /Q $(subst /,\,$(cfiles)) $(subst /,\,$(asmfiles))
|
|
||||||
else
|
|
||||||
doClean = rm $(cfiles) $(asmfiles)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(cfiles) $(asmfiles)
|
|
||||||
ar -rcs $(LIBNAME) $^
|
|
||||||
|
|
||||||
$(cfiles): $(INCLUDE)/*.h
|
|
||||||
|
|
||||||
$(asmfiles):
|
|
||||||
fasm $*.asm $*.o
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(doClean)
|
|
||||||
|
|
||||||
install:
|
|
||||||
cp $(LIBNAME) ../bin/lib
|
|
@ -1,71 +0,0 @@
|
|||||||
@echo off
|
|
||||||
echo ####################################################
|
|
||||||
echo # Melibc builder #
|
|
||||||
echo # usage: build [clean] #
|
|
||||||
echo ####################################################
|
|
||||||
rem #### CONFIG SECTION ####
|
|
||||||
set LIBNAME=libck.a
|
|
||||||
set INCLUDE=include
|
|
||||||
set CC=kos32-tcc
|
|
||||||
set CFLAGS=-c -nostdinc -DGNUC -I"%cd%\%INCLUDE%" -Wall
|
|
||||||
set AR=kos32-ar
|
|
||||||
set ASM=fasm
|
|
||||||
set dirs=stdio memory kolibrisys string stdlib math dlfcn libgen fs net
|
|
||||||
rem #### END OF CONFIG SECTION ####
|
|
||||||
|
|
||||||
set objs=
|
|
||||||
set target=%1
|
|
||||||
if not "%1"=="clean" set target=all
|
|
||||||
|
|
||||||
set INCLUDE="%cd%"
|
|
||||||
call :Target_%target%
|
|
||||||
|
|
||||||
if ERRORLEVEL 0 goto Exit_OK
|
|
||||||
|
|
||||||
echo Probably at runing has been created error
|
|
||||||
echo For help send a report...
|
|
||||||
pause
|
|
||||||
goto :eof
|
|
||||||
|
|
||||||
:Compile_C
|
|
||||||
echo compile .c %1
|
|
||||||
%CC% %CFLAGS% %1 -o "%~dpn1.o"
|
|
||||||
if not %errorlevel%==0 goto Error_Failed
|
|
||||||
set objs=%objs% "%~dpn1.o"
|
|
||||||
goto :eof
|
|
||||||
|
|
||||||
:Compile_Asm
|
|
||||||
echo compile .asm %1
|
|
||||||
%ASM% %1 "%~dpn1.o"
|
|
||||||
if not %errorlevel%==0 goto Error_Failed
|
|
||||||
set objs=%objs% "%~dpn1.o"
|
|
||||||
goto :eof
|
|
||||||
|
|
||||||
:Target_clean
|
|
||||||
echo cleaning ...
|
|
||||||
for %%a in (%dirs%) do del /Q "%%a\*.o"
|
|
||||||
goto :Exit_OK
|
|
||||||
|
|
||||||
:Target_all
|
|
||||||
echo building all ...
|
|
||||||
for %%a in (%dirs%) do (
|
|
||||||
for %%f in ("%%a\*.asm") do call :Compile_Asm "%%f"
|
|
||||||
for %%f in ("%%a\*.c") do call :Compile_C "%%f"
|
|
||||||
)
|
|
||||||
echo calling AR
|
|
||||||
%AR% -ru %LIBNAME% %objs%
|
|
||||||
if not %errorlevel%==0 goto Error_Failed
|
|
||||||
goto Exit_OK
|
|
||||||
|
|
||||||
:Error_Failed
|
|
||||||
echo error: execution failed
|
|
||||||
pause
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
:Exit_OK
|
|
||||||
echo ####################################################
|
|
||||||
echo # All operations has been done... #
|
|
||||||
echo # For cleaning run this script with param " clean" #
|
|
||||||
echo ####################################################
|
|
||||||
pause
|
|
||||||
exit 0
|
|
@ -1,91 +0,0 @@
|
|||||||
#include <kos32sys1.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
void *ptr;
|
|
||||||
} KosExp;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
void **importNames;
|
|
||||||
char * libraryName;
|
|
||||||
} KosImp;
|
|
||||||
|
|
||||||
static int stdcall dll_Load(KosImp *importTableEntry);
|
|
||||||
|
|
||||||
static const char *__error;
|
|
||||||
|
|
||||||
static int stdcall dll_Load(KosImp *importTableEntry) {
|
|
||||||
for (; importTableEntry->importNames; importTableEntry++) {
|
|
||||||
char libPath[256] = "/sys/lib/";
|
|
||||||
KosExp *exports = NULL;
|
|
||||||
void **libImports = importTableEntry->importNames;
|
|
||||||
|
|
||||||
strcat(libPath, importTableEntry->libraryName);
|
|
||||||
if (!(exports = dlopen(libPath, 0))) { return 1; }
|
|
||||||
for (; *libImports; libImports++) {
|
|
||||||
if (!(*libImports = dlsym(exports, *libImports))) { return 1; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/007908799/xsh/dlopen.html
|
|
||||||
// Current implementation fully ignores "mode" parameter
|
|
||||||
void *dlopen(const char *name, int mode) {
|
|
||||||
KosExp *exports = NULL;
|
|
||||||
|
|
||||||
// load library using syscall
|
|
||||||
asm volatile ("int $0x40":"=a"(exports):"a"(68), "b"(19), "c"(name));
|
|
||||||
if (!exports) {
|
|
||||||
char libPath[256] = "/sys/lib/";
|
|
||||||
|
|
||||||
strcat(libPath, name);
|
|
||||||
asm volatile ("int $0x40":"=a"(exports):"a"(68), "b"(19), "c"(libPath));
|
|
||||||
if (!exports) {
|
|
||||||
__error = "Library not found in \"/sys/lib/\" nor current folder";
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// call anything starting with "lib_"
|
|
||||||
for (KosExp *export = exports; export->name; export++) {
|
|
||||||
if (!memcmp(export->name, "lib_", 4)) {
|
|
||||||
asm volatile (
|
|
||||||
"call *%4" ::
|
|
||||||
"a"(sysmalloc),
|
|
||||||
"b"(sysfree),
|
|
||||||
"c"(sysrealloc),
|
|
||||||
"d"(dll_Load),
|
|
||||||
"r"(export->ptr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return exports;
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/007908799/xsh/dlsym.html
|
|
||||||
void *dlsym(void *handle, const char *name) {
|
|
||||||
KosExp *exp = handle;
|
|
||||||
|
|
||||||
for (; exp->name; exp++) {
|
|
||||||
if (!strcmp(exp->name, name)) {
|
|
||||||
return exp->ptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__error = "Symbol not found";
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/007908799/xsh/dlclose.html
|
|
||||||
int dlclose(void *handle) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/007908799/xsh/dlerror.html
|
|
||||||
char *dlerror(void) {
|
|
||||||
char *ret = __error ? strdup(__error) : NULL;
|
|
||||||
__error = NULL;
|
|
||||||
return ret;
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
/* Copyright (C) 2019-2021 Logaev Maxim (turbocat2001), GPLv3 */
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <dir.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
|
||||||
typedef struct {
|
|
||||||
unsigned p00;
|
|
||||||
unsigned long long p04;
|
|
||||||
unsigned p12;
|
|
||||||
unsigned p16;
|
|
||||||
char p20;
|
|
||||||
char *p21;
|
|
||||||
} kol_struct70;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
int kol_file_70(kol_struct70 *k)
|
|
||||||
{
|
|
||||||
asm volatile ("int $0x40"::"a"(70), "b"(k));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool dir_operations(unsigned char fun_num, char *path)
|
|
||||||
{
|
|
||||||
kol_struct70 inf;
|
|
||||||
inf.p00 = fun_num;
|
|
||||||
inf.p04 = 0;
|
|
||||||
inf.p12 = 0;
|
|
||||||
inf.p16 = 0;
|
|
||||||
inf.p20 = 0;
|
|
||||||
inf.p21 = path;
|
|
||||||
if(!kol_file_70(&inf)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int lsdir(const char* dir, short_file_info **list)
|
|
||||||
{
|
|
||||||
int num_of_file=0;
|
|
||||||
kol_struct70 inf;
|
|
||||||
|
|
||||||
inf.p00 = 1;
|
|
||||||
inf.p04 = 0;
|
|
||||||
inf.p12 = 2;
|
|
||||||
inf.p16 = (unsigned) malloc(32+inf.p12*560);
|
|
||||||
inf.p20 = 0;
|
|
||||||
inf.p21 = (char*)dir;
|
|
||||||
|
|
||||||
if(kol_file_70(&inf))
|
|
||||||
{
|
|
||||||
free((void*)inf.p16);
|
|
||||||
return FS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
num_of_file = *(unsigned*)(inf.p16+8);
|
|
||||||
inf.p12 = num_of_file;
|
|
||||||
free((void*)inf.p16);
|
|
||||||
inf.p16 = (unsigned) malloc(32+inf.p12*560);
|
|
||||||
*list = (short_file_info*)malloc(num_of_file*sizeof(short_file_info));
|
|
||||||
|
|
||||||
if(kol_file_70(&inf))
|
|
||||||
{
|
|
||||||
free((void*)inf.p16);
|
|
||||||
return FS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i=0; i<num_of_file; i++)
|
|
||||||
{
|
|
||||||
(*list)[i].type = *(unsigned*)(inf.p16+32+(264+40)*i);
|
|
||||||
(*list)[i].name =(char*)(inf.p16+32+40+(264+40)*i);
|
|
||||||
}
|
|
||||||
return num_of_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char *getcwd(char *buf, unsigned size)
|
|
||||||
{
|
|
||||||
if(buf == NULL){
|
|
||||||
if((buf = malloc(size))==NULL)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(30),"b"(2),"c"(buf), "d"(size));
|
|
||||||
return(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setcwd(const char* cwd)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(30),"b"(1),"c"(cwd));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rmdir(const char* dir)
|
|
||||||
{
|
|
||||||
return dir_operations(8, (char*)dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool mkdir(const char* dir)
|
|
||||||
{
|
|
||||||
return dir_operations(9, (char*)dir);
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
#ifndef __ASSERT_H
|
|
||||||
#define __ASSERT_H
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
|
||||||
# define assert(a) (void)0
|
|
||||||
#else
|
|
||||||
# define assert(a) ((a) ? (void)0 : __assert_func (__FILE__, __LINE__, #a))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
|
||||||
# define TRACE(s) void(0)
|
|
||||||
#else
|
|
||||||
# define TRACE(s) (__trace_func (__FILE__, __LINE__, #s))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void __assert_func(char*,int,char*);
|
|
||||||
void __trace_func(char*,int,char*);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,265 +0,0 @@
|
|||||||
// writed by maxcodehack and superturbocat2001
|
|
||||||
// adaptation of clayer for ktcc
|
|
||||||
#ifndef KOLIBRI_BOXLIB_H
|
|
||||||
#define KOLIBRI_BOXLIB_H
|
|
||||||
|
|
||||||
typedef unsigned color_t;
|
|
||||||
|
|
||||||
extern int kolibri_boxlib_init(void);
|
|
||||||
|
|
||||||
/* flags meaning */
|
|
||||||
#define ed_figure_only 0b1000000000000000 // одни символы
|
|
||||||
#define ed_always_focus 0b100000000000000 // всегда с курсором (фокусом)
|
|
||||||
#define ed_focus 0b10 // фокус ввода приложения, мышится самостоятельно
|
|
||||||
#define ed_pass 0b1 // поле с паролем
|
|
||||||
#define ed_shift_on 0b1000 // если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая //shift
|
|
||||||
#define ed_shift_on_off 0b1111111111110111
|
|
||||||
#define ed_shift 0b100 //включается при нажатии на shift т.е. если нажимаю
|
|
||||||
#define ed_shift_off 0b1111111111111011
|
|
||||||
#define ed_shift_bac 0b10000 //бит для очистки выделеного shift т.е. при установке говорит что есть выделение
|
|
||||||
#define ed_shift_bac_cl 0b1111111111101111 //очистка при удалении выделения
|
|
||||||
#define ed_shift_cl 0b1111111111100011
|
|
||||||
#define ed_shift_mcl 0b1111111111111011
|
|
||||||
#define ed_left_fl 0b100000
|
|
||||||
#define ed_right_fl 0b1111111111011111
|
|
||||||
#define ed_offset_fl 0b1000000
|
|
||||||
#define ed_offset_cl 0b1111111110111111
|
|
||||||
#define ed_insert 0b10000000
|
|
||||||
#define ed_insert_cl 0b1111111101111111
|
|
||||||
#define ed_mouse_on 0b100000000
|
|
||||||
#define ed_mous_adn_b 0b100011000
|
|
||||||
#define ed_mouse_off ~ed_mouse_on
|
|
||||||
#define ed_ctrl_on 0b1000000000
|
|
||||||
#define ed_ctrl_off ~ed_ctrl_on
|
|
||||||
#define ed_alt_on 0b10000000000
|
|
||||||
#define ed_alt_off ~ed_alt_on
|
|
||||||
#define ed_disabled 0b100000000000
|
|
||||||
|
|
||||||
// SCROLLBAR
|
|
||||||
typedef struct {
|
|
||||||
uint16_t xsize;
|
|
||||||
uint16_t xpos;
|
|
||||||
uint16_t ysize;
|
|
||||||
uint16_t ypos;
|
|
||||||
uint32_t btn_height;
|
|
||||||
uint32_t type; // type 1 - stylish frame, type 2 - ?, type 0 - ?
|
|
||||||
uint32_t max_area;
|
|
||||||
uint32_t cur_area;
|
|
||||||
uint32_t position;
|
|
||||||
uint32_t back_color;
|
|
||||||
uint32_t front_color;
|
|
||||||
uint32_t line_color;
|
|
||||||
uint32_t redraw;
|
|
||||||
uint16_t delta;
|
|
||||||
uint16_t delta2;
|
|
||||||
uint16_t r_size_x;
|
|
||||||
uint16_t r_start_x;
|
|
||||||
uint16_t r_size_y;
|
|
||||||
uint16_t r_start_y;
|
|
||||||
uint32_t m_pos;
|
|
||||||
uint32_t m_pos2;
|
|
||||||
uint32_t m_keys;
|
|
||||||
uint32_t run_size;
|
|
||||||
uint32_t position2;
|
|
||||||
uint32_t work_size;
|
|
||||||
uint32_t all_redraw; // need to be set =1 before each redraw
|
|
||||||
uint32_t ar_offset;
|
|
||||||
} __attribute__ ((__packed__)) scrollbar;
|
|
||||||
|
|
||||||
extern void (*scrollbar_h_draw __attribute__((__stdcall__)))(scrollbar*);
|
|
||||||
extern void (*scrollbar_h_mouse __attribute__((__stdcall__)))(scrollbar*);
|
|
||||||
extern void (*scrollbar_v_draw __attribute__((__stdcall__)))(scrollbar*);
|
|
||||||
extern void (*scrollbar_v_mouse __attribute__((__stdcall__)))(scrollbar*);
|
|
||||||
|
|
||||||
// CHECKBOX
|
|
||||||
typedef struct {
|
|
||||||
unsigned int left_s;
|
|
||||||
unsigned int top_s;
|
|
||||||
unsigned int ch_text_margin;
|
|
||||||
unsigned int color;
|
|
||||||
unsigned int border_color;
|
|
||||||
unsigned int text_color;
|
|
||||||
char *text;
|
|
||||||
unsigned int flags;
|
|
||||||
|
|
||||||
/* Users can use members above this */
|
|
||||||
unsigned int size_of_str;
|
|
||||||
}check_box;
|
|
||||||
|
|
||||||
extern void (*check_box_draw2 __attribute__((__stdcall__)))(check_box *);
|
|
||||||
extern void (*check_box_mouse2 __attribute__((__stdcall__)))(check_box *);
|
|
||||||
extern void (*init_checkbox2 __attribute__((__stdcall__)))(check_box *);
|
|
||||||
|
|
||||||
// DBUTTON
|
|
||||||
typedef struct {
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t x_w;
|
|
||||||
uint32_t y_h;
|
|
||||||
uint32_t mouse_pos;
|
|
||||||
uint32_t mouse_keys;
|
|
||||||
uint32_t mouse_keys_old;
|
|
||||||
void* active_raw; //active bitmap
|
|
||||||
void* passive_raw; //passive bitmap
|
|
||||||
void* click_raw; //pressed bitmap
|
|
||||||
uint32_t resolution_raw; // bpp, as esi fn65
|
|
||||||
void* palette_raw; // palette, as edi fn65
|
|
||||||
uint32_t offset_raw; // width as ebp fn65
|
|
||||||
uint32_t select; // internal state: 0 - passive, 2 - pressed, 1 - clicked
|
|
||||||
uint32_t click; // clicked - 1, zero it after tested
|
|
||||||
} pict_button;
|
|
||||||
|
|
||||||
extern void (*dynamic_button_draw __attribute__((__stdcall__)))(pict_button *);
|
|
||||||
extern void (*dynamic_button_mouse __attribute__((__stdcall__)))(pict_button *);
|
|
||||||
|
|
||||||
// EDITBOX
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
|
||||||
typedef struct edit_box_t {
|
|
||||||
unsigned int width;
|
|
||||||
unsigned int left;
|
|
||||||
unsigned int top;
|
|
||||||
unsigned int color;
|
|
||||||
unsigned int shift_color; // selected text color
|
|
||||||
unsigned int focus_border_color;
|
|
||||||
unsigned int blur_border_color;
|
|
||||||
unsigned int text_color;
|
|
||||||
unsigned int max;
|
|
||||||
char *text;
|
|
||||||
void *mouse_variable; // must be pointer edit_box** to save focused editbox
|
|
||||||
unsigned int flags;
|
|
||||||
|
|
||||||
unsigned int size; // used symbols in buffer without trailing zero
|
|
||||||
unsigned int pos; // cursor position
|
|
||||||
/* The following struct members are not used by the users of API */
|
|
||||||
unsigned int offset;
|
|
||||||
unsigned int cl_curs_x;
|
|
||||||
unsigned int cl_curs_y;
|
|
||||||
unsigned int shift;
|
|
||||||
unsigned int shift_old;
|
|
||||||
unsigned int height;
|
|
||||||
unsigned int char_width;
|
|
||||||
}edit_box;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
extern void (*edit_box_draw __attribute__((__stdcall__)))(edit_box *);
|
|
||||||
extern void edit_box_key (edit_box *, unsigned int key_val)__attribute__((__stdcall__));
|
|
||||||
extern void (*edit_box_mouse __attribute__((__stdcall__)))(edit_box *);
|
|
||||||
extern void (*edit_box_set_text __attribute__((__stdcall__)))(edit_box *, char *);
|
|
||||||
|
|
||||||
// FRAME
|
|
||||||
typedef struct {
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t x_w;
|
|
||||||
uint32_t y_h;
|
|
||||||
color_t ext_col;
|
|
||||||
color_t int_col;
|
|
||||||
uint32_t flags;
|
|
||||||
char *text_pointer;
|
|
||||||
uint32_t text_position;
|
|
||||||
uint32_t font_number;
|
|
||||||
uint32_t font_size_y;
|
|
||||||
color_t font_color;
|
|
||||||
color_t font_bg_color;
|
|
||||||
}frame;
|
|
||||||
|
|
||||||
extern void (*frame_draw)(frame *);
|
|
||||||
|
|
||||||
// MENUBAR
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t type; // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò
|
|
||||||
|
|
||||||
uint32_t x_w; // âåðõíèé ïóíêò
|
|
||||||
uint32_t y_h;
|
|
||||||
|
|
||||||
char* text_pointer;
|
|
||||||
char* pos_pointer;
|
|
||||||
char* text_end;
|
|
||||||
uint32_t mouse_pos;
|
|
||||||
uint32_t mouse_keys;
|
|
||||||
|
|
||||||
uint32_t x_w1; // ïîäìåíþ
|
|
||||||
uint32_t y_h1;
|
|
||||||
|
|
||||||
color_t bckg_col; // ôîí âåðõíåãî ïóêòà
|
|
||||||
color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà
|
|
||||||
color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû)
|
|
||||||
uint32_t select;
|
|
||||||
uint32_t out_select;
|
|
||||||
char* buf_adress;
|
|
||||||
char* procinfo;
|
|
||||||
uint32_t click;
|
|
||||||
uint32_t cursor;
|
|
||||||
uint32_t cursor_old;
|
|
||||||
uint32_t interval;
|
|
||||||
uint32_t cursor_max;
|
|
||||||
uint32_t extended_key;
|
|
||||||
color_t menu_sel_col; // öâåò ôîíà âûáðàííîãî ïîäïóíêòà
|
|
||||||
color_t bckg_text_col; // öâåò øðèôòà íåâûáðàííîãî ïóíêòà
|
|
||||||
color_t frnt_text_col; // öâåò øðèôòà âûáðàííîãî ïóíêòà
|
|
||||||
uint32_t mouse_keys_old;
|
|
||||||
uint32_t font_height;
|
|
||||||
uint32_t cursor_out;
|
|
||||||
uint32_t get_mouse_flag;
|
|
||||||
} menubar;
|
|
||||||
|
|
||||||
extern void (*menu_bar_draw)(menubar *);
|
|
||||||
extern void (*menu_bar_mouse)(menubar *);
|
|
||||||
extern void (*menu_bar_activate)(menubar *);
|
|
||||||
|
|
||||||
// OPTIONBOX
|
|
||||||
typedef struct option_box_t {
|
|
||||||
struct option_box_t **selected;
|
|
||||||
uint16_t posx;
|
|
||||||
uint16_t posy;
|
|
||||||
uint32_t text_margin; // = 4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè
|
|
||||||
uint32_t size; // 12 ðàçìåð êâàäðàòà ÷åê áîêñà
|
|
||||||
color_t color;
|
|
||||||
color_t border_color; // individual border
|
|
||||||
color_t text_color;
|
|
||||||
char *text;
|
|
||||||
uint32_t text_len;
|
|
||||||
uint32_t flags;
|
|
||||||
} __attribute__ ((__packed__)) option_box;
|
|
||||||
|
|
||||||
extern void (*option_box_draw __attribute__((__stdcall__)))(option_box **);
|
|
||||||
extern void (*option_box_mouse __attribute__((__stdcall__)))(option_box **);
|
|
||||||
|
|
||||||
// PATHSHOW
|
|
||||||
typedef struct {
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t x_y;
|
|
||||||
uint16_t font_size_x; // 6 - for font 0, 8 - for font 1
|
|
||||||
uint16_t area_size_x;
|
|
||||||
uint32_t font_number; // 0 - monospace, 1 - variable, as fn4 (2bit only 0-3)
|
|
||||||
uint32_t background_flag; // as fn4, if 0, bk_color unneeded
|
|
||||||
color_t font_color; // as fn4
|
|
||||||
color_t background_color; // as fn4
|
|
||||||
char* text_pointer; // 4096 ?
|
|
||||||
char* work_area_pointer; // 4096 ?
|
|
||||||
uint32_t temp_text_length;
|
|
||||||
} __attribute__ ((__packed__)) pathview;
|
|
||||||
|
|
||||||
extern void (*path_show_prepare __attribute__((__stdcall__)))(pathview *);
|
|
||||||
extern void (*path_show_draw __attribute__((__stdcall__)))(pathview *);
|
|
||||||
|
|
||||||
// PROGRESSBAR
|
|
||||||
typedef struct {
|
|
||||||
unsigned int value;
|
|
||||||
unsigned int left;
|
|
||||||
unsigned int top;
|
|
||||||
unsigned int width;
|
|
||||||
unsigned int height;
|
|
||||||
unsigned int style;
|
|
||||||
unsigned int min;
|
|
||||||
unsigned int max;
|
|
||||||
unsigned int back_color;
|
|
||||||
unsigned int progress_color;
|
|
||||||
unsigned int frame_color;
|
|
||||||
} progressbar;
|
|
||||||
|
|
||||||
extern void (*progressbar_draw __attribute__((__stdcall__)))(progressbar *);
|
|
||||||
extern void (*progressbar_progress __attribute__((__stdcall__)))(progressbar *);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* KOLIBRI_BOXLIB_H */
|
|
@ -1,83 +0,0 @@
|
|||||||
#ifndef KOLIBRI_BUF2D_H
|
|
||||||
#define KOLIBRI_BUF2D_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
/*ToDo
|
|
||||||
* voxel function
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int kolibri_buf2d_init(void);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int *buf_pointer;
|
|
||||||
uint16_t left;
|
|
||||||
uint16_t top;
|
|
||||||
unsigned int width;
|
|
||||||
unsigned int height;
|
|
||||||
unsigned int bgcolor;
|
|
||||||
uint8_t color_bit;
|
|
||||||
} __attribute__ ((__packed__))buf2d_struct;
|
|
||||||
|
|
||||||
enum BUF2D_ALGORITM_FILTR {
|
|
||||||
SIERRA_LITE,
|
|
||||||
FLOYD_STEINBERG,
|
|
||||||
BURKERS,
|
|
||||||
HEAVYIRON_MOD,
|
|
||||||
ATKINSON
|
|
||||||
};
|
|
||||||
|
|
||||||
enum BUF2D_OPT_CROP {
|
|
||||||
BUF2D_OPT_CROP_TOP = 1,
|
|
||||||
BUF2D_OPT_CROP_LEFT = 2,
|
|
||||||
BUF2D_OPT_CROP_BOTTOM = 4,
|
|
||||||
BUF2D_OPT_CROP_RIGHT = 8
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void (*buf2d_create_asm __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_curve_bezier_asm __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
|
|
||||||
|
|
||||||
buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit)
|
|
||||||
{
|
|
||||||
buf2d_struct *new_buf2d_struct = (buf2d_struct *)malloc(sizeof(buf2d_struct));
|
|
||||||
new_buf2d_struct -> left = tlx;
|
|
||||||
new_buf2d_struct -> top = tly;
|
|
||||||
new_buf2d_struct -> width = sizex;
|
|
||||||
new_buf2d_struct -> height = sizey;
|
|
||||||
new_buf2d_struct -> bgcolor = font_bgcolor;
|
|
||||||
new_buf2d_struct -> color_bit = color_bit;
|
|
||||||
buf2d_create_asm(new_buf2d_struct);
|
|
||||||
return new_buf2d_struct;
|
|
||||||
}
|
|
||||||
|
|
||||||
void buf2d_curve_bezier(buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color)
|
|
||||||
{
|
|
||||||
buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void (*buf2d_draw __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_clear __attribute__((__stdcall__)))(buf2d_struct *, unsigned int);
|
|
||||||
extern void (*buf2d_delete __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_rotate __attribute__((__stdcall__)))(buf2d_struct *, unsigned int);
|
|
||||||
extern void (*buf2d_resize __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_line __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_line_sm __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_rect_by_size __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_filled_rect_by_size __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_circle __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_img_hdiv2 __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_img_wdiv2 __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_conv_24_to_8 __attribute__((__stdcall__)))(buf2d_struct *, unsigned int);
|
|
||||||
extern void (*buf2d_conv_24_to_32 __attribute__((__stdcall__)))(buf2d_struct *, unsigned int);
|
|
||||||
extern void (*buf2d_bit_blt_transp __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *);
|
|
||||||
extern void (*buf2d_bit_blt_alpha __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, buf2d_struct *);
|
|
||||||
extern void (*buf2d_convert_text_matrix __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_draw_text __attribute__((__stdcall__)))(buf2d_struct *, buf2d_struct *, const char *, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_crop_color __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_offset_h __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_flood_fill __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_set_pixel __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int, unsigned int);
|
|
||||||
extern unsigned int (*buf2d_get_pixel __attribute__((__stdcall__)))(buf2d_struct *, unsigned int, unsigned int);
|
|
||||||
extern void (*buf2d_flip_h __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_flip_v __attribute__((__stdcall__)))(buf2d_struct *);
|
|
||||||
extern void (*buf2d_filter_dither __attribute__((__stdcall__)))(buf2d_struct *, unsigned int);
|
|
||||||
#endif /* KOLIBRI_BUF2D_H */
|
|
@ -1,126 +0,0 @@
|
|||||||
#ifndef KOLIBRI_DIALOG_H
|
|
||||||
#define KOLIBRI_DIALOG_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#define NOT_SUCCESS 0
|
|
||||||
#define SUCCESS 1
|
|
||||||
|
|
||||||
char sz_com_area_name[] = "FFFFFFFF_open_dialog";
|
|
||||||
char sz_dir_default_path[] = "/rd/1";
|
|
||||||
char sz_start_path[] = "/rd/1/File managers/opendial";
|
|
||||||
|
|
||||||
char cd_com_area_name[] = "FFFFFFFF_color_dialog";
|
|
||||||
char cd_start_path[] = "/rd/1/colrdial";
|
|
||||||
|
|
||||||
enum open_dialog_mode {
|
|
||||||
OPEN,
|
|
||||||
SAVE,
|
|
||||||
SELECT
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int size;
|
|
||||||
unsigned char end;
|
|
||||||
}od_filter __attribute__ ((__packed__));
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int mode;
|
|
||||||
char* procinfo;
|
|
||||||
char* com_area_name;
|
|
||||||
unsigned int com_area;
|
|
||||||
char* opendir_path;
|
|
||||||
char* dir_default_path;
|
|
||||||
char* start_path;
|
|
||||||
void (*draw_window)();
|
|
||||||
unsigned int status;
|
|
||||||
char* openfile_path;
|
|
||||||
char* filename_area;
|
|
||||||
od_filter* filter_area;
|
|
||||||
unsigned short x_size;
|
|
||||||
unsigned short x_start;
|
|
||||||
unsigned short y_size;
|
|
||||||
unsigned short y_start;
|
|
||||||
}open_dialog __attribute__ ((__packed__));
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct{
|
|
||||||
unsigned int type;
|
|
||||||
char* procinfo;
|
|
||||||
char* com_area_name;
|
|
||||||
unsigned int com_area;
|
|
||||||
char* start_path;
|
|
||||||
void (*draw_window)(void);
|
|
||||||
unsigned int status;
|
|
||||||
unsigned short x_size;
|
|
||||||
unsigned short x_start;
|
|
||||||
unsigned short y_size;
|
|
||||||
unsigned short y_start;
|
|
||||||
unsigned int color_type;
|
|
||||||
unsigned int color;
|
|
||||||
}color_dialog __attribute__ ((__packed__));
|
|
||||||
|
|
||||||
void fake_on_redraw(void) {}
|
|
||||||
|
|
||||||
open_dialog* kolibri_new_open_dialog(unsigned int mode, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
|
|
||||||
{
|
|
||||||
open_dialog *new_opendialog = (open_dialog *)malloc(sizeof(open_dialog));
|
|
||||||
od_filter *new_od_filter = (od_filter *)malloc(sizeof(od_filter));
|
|
||||||
char *plugin_path = (char *)calloc(4096, sizeof(char));
|
|
||||||
char *openfile_path = (char *)calloc(4096, sizeof(char));
|
|
||||||
char *proc_info = (char *)calloc(1024, sizeof(char));
|
|
||||||
char *filename_area = (char *)calloc(256, sizeof(char));
|
|
||||||
|
|
||||||
new_od_filter -> size = 0;
|
|
||||||
new_od_filter -> end = 0;
|
|
||||||
|
|
||||||
new_opendialog -> mode = mode;
|
|
||||||
new_opendialog -> procinfo = proc_info;
|
|
||||||
new_opendialog -> com_area_name = sz_com_area_name;
|
|
||||||
new_opendialog -> com_area = 0;
|
|
||||||
new_opendialog -> opendir_path = plugin_path;
|
|
||||||
new_opendialog -> dir_default_path = sz_dir_default_path;
|
|
||||||
new_opendialog -> start_path = sz_start_path;
|
|
||||||
new_opendialog -> draw_window = &fake_on_redraw;
|
|
||||||
new_opendialog -> status = 0;
|
|
||||||
new_opendialog -> openfile_path = openfile_path;
|
|
||||||
new_opendialog -> filename_area = filename_area;
|
|
||||||
new_opendialog -> filter_area = new_od_filter;
|
|
||||||
new_opendialog -> x_size = x_size;
|
|
||||||
new_opendialog -> x_start = tlx;
|
|
||||||
new_opendialog -> y_size = y_size;
|
|
||||||
new_opendialog -> y_start = tly;
|
|
||||||
return new_opendialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cd_fake_on_redraw(void) {}
|
|
||||||
|
|
||||||
color_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
|
|
||||||
{
|
|
||||||
color_dialog *new_colordialog = (color_dialog *)malloc(sizeof(color_dialog));
|
|
||||||
char *proc_info = (char *)calloc(1024, sizeof(char));
|
|
||||||
|
|
||||||
new_colordialog -> type = type;
|
|
||||||
new_colordialog -> procinfo = proc_info;
|
|
||||||
new_colordialog -> com_area_name = cd_com_area_name;
|
|
||||||
new_colordialog -> com_area = 0;
|
|
||||||
new_colordialog -> start_path = cd_start_path;
|
|
||||||
new_colordialog -> draw_window = &cd_fake_on_redraw;
|
|
||||||
new_colordialog -> status = 0;
|
|
||||||
new_colordialog -> x_size = x_size;
|
|
||||||
new_colordialog -> x_start = tlx;
|
|
||||||
new_colordialog -> y_size = y_size;
|
|
||||||
new_colordialog -> y_start = tly;
|
|
||||||
new_colordialog -> color_type = 0;
|
|
||||||
new_colordialog -> color = 0;
|
|
||||||
return new_colordialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void kolibri_dialog_init();
|
|
||||||
|
|
||||||
extern void (*OpenDialog_init __attribute__((__stdcall__)))(open_dialog *);
|
|
||||||
extern void (*OpenDialog_start __attribute__((__stdcall__)))(open_dialog *);
|
|
||||||
|
|
||||||
extern void (*ColorDialog_init __attribute__((__stdcall__)))(color_dialog *);
|
|
||||||
extern void (*ColorDialog_start __attribute__((__stdcall__)))(color_dialog *);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,19 +0,0 @@
|
|||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int w;
|
|
||||||
int h;
|
|
||||||
char *bmp;
|
|
||||||
char *alpha;
|
|
||||||
} GB_BMP;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
void gb_pixel_set(GB_BMP *b, int x, int y, unsigned c);
|
|
||||||
int gb_pixel_get(GB_BMP *b, int x, int y, unsigned *c);
|
|
||||||
void gb_line(GB_BMP *b, int x1, int y1, int x2, int y2, unsigned c);
|
|
||||||
void gb_rect(GB_BMP *b, int x, int y, int w, int h, unsigned c);
|
|
||||||
void gb_bar(GB_BMP *b, int x, int y, int w, int h, unsigned c);
|
|
||||||
void gb_circle(GB_BMP *b, int x, int y, int r, unsigned c);
|
|
||||||
void gb_image_set(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h);
|
|
||||||
void gb_image_set_t(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h, unsigned c);
|
|
@ -1,153 +0,0 @@
|
|||||||
/*
|
|
||||||
This is adapded thunk for http.obj sys library
|
|
||||||
.h is equal to svn:\\programs\develop\libraries\http\http_en.txt
|
|
||||||
|
|
||||||
Adapted for TCC's dynamic API by Magomed Kostoev, 2020
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _HTTP_H_
|
|
||||||
#define _HTTP_H_
|
|
||||||
|
|
||||||
#define cdecl __attribute__ ((cdecl))
|
|
||||||
#define stdcall __attribute__ ((stdcall))
|
|
||||||
|
|
||||||
// Bitflags for http_msg.flags
|
|
||||||
// status
|
|
||||||
|
|
||||||
#define HTTP_FLAG_HTTP11 1 << 0
|
|
||||||
#define HTTP_FLAG_GOT_HEADER 1 << 1
|
|
||||||
#define HTTP_FLAG_GOT_ALL_DATA 1 << 2
|
|
||||||
#define HTTP_FLAG_CONTENT_LENGTH 1 << 3
|
|
||||||
#define HTTP_FLAG_CHUNKED 1 << 4
|
|
||||||
#define HTTP_FLAG_CONNECTED 1 << 5
|
|
||||||
|
|
||||||
// user options
|
|
||||||
#define HTTP_FLAG_KEEPALIVE 1 << 8
|
|
||||||
#define HTTP_FLAG_STREAM 1 << 9
|
|
||||||
#define HTTP_FLAG_REUSE_BUFFER 1 << 10
|
|
||||||
#define HTTP_FLAG_BLOCK 1 << 11
|
|
||||||
|
|
||||||
// error
|
|
||||||
#define HTTP_FLAG_INVALID_HEADER 1 << 16
|
|
||||||
#define HTTP_FLAG_NO_RAM 1 << 17
|
|
||||||
#define HTTP_FLAG_SOCKET_ERROR 1 << 18
|
|
||||||
#define HTTP_FLAG_TIMEOUT_ERROR 1 << 19
|
|
||||||
#define HTTP_FLAG_TRANSFER_FAILED 1 << 20
|
|
||||||
|
|
||||||
/*
|
|
||||||
User flags:
|
|
||||||
|
|
||||||
For the flag codes themselves, see http.inc file.
|
|
||||||
|
|
||||||
FLAG_KEEPALIVE will keep the connection open after first GET/POST/.. so you can send a second request on the same TCP session.
|
|
||||||
In this case, the session must be closed manually when done by using the exported disconnect() function.
|
|
||||||
|
|
||||||
FLAG_STREAM will force receive() to put the received content in a series of fixed size buffers, instead of everything in one big buffer.
|
|
||||||
This can be used for example to receive an internet radio stream,
|
|
||||||
but also to download larger files for which it does not make sense to put them completely in RAM first.
|
|
||||||
|
|
||||||
FLAG_REUSE_BUFFER is to be used in combination with FLAG_STREAM and will make receive() function re-use the same buffer.
|
|
||||||
This, for example, can be used when downloading a file straight to disk.
|
|
||||||
|
|
||||||
FLAG_BLOCK will make receive() function blocking. This is only to be used when receiving one file from a thread that has no other work.
|
|
||||||
If however, you want to receive multiple files, or do other things in the program mainloop, you should call the receive function periodically.
|
|
||||||
You may use system function 10 or 23 to wait for network event before calling one or more receive() functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
|
||||||
typedef struct http_msg_s {
|
|
||||||
unsigned socket; // socket on which the actual transfer happens
|
|
||||||
unsigned flags; // flags, reflects status of the transfer using bitflags
|
|
||||||
unsigned write_ptr; // internal use only (where to write new data in buffer)
|
|
||||||
unsigned buffer_length; // internal use only (number of available bytes in buffer)
|
|
||||||
unsigned chunk_ptr; // internal use only (where the next chunk begins)
|
|
||||||
unsigned timestamp; // internal use only (when last data was received)
|
|
||||||
unsigned status; // HTTP status
|
|
||||||
unsigned header_length; // length of HTTP header
|
|
||||||
void * content_ptr; // ptr to content
|
|
||||||
unsigned content_length; // total length of HTTP content
|
|
||||||
unsigned content_received; // number of currently received content bytes
|
|
||||||
char * http_header;
|
|
||||||
} http_msg;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
/*
|
|
||||||
url = pointer to ASCIIZ URL
|
|
||||||
identifier = identifier of previously opened connection (keep-alive), or 0 to open a new one.
|
|
||||||
flags = bit flags (see end of this document).
|
|
||||||
add_header = pointer to ASCIIZ additional header parameters, or null for none.
|
|
||||||
Every additional parameter must end with CR LF bytes, including the last line.
|
|
||||||
Initiates a HTTP connection, using 'GET' method.
|
|
||||||
Returns NULL on error, identifier otherwise.
|
|
||||||
*/
|
|
||||||
extern http_msg * stdcall (*http_get)(const char *url, http_msg *identifier, unsigned flags, const char *add_header);
|
|
||||||
|
|
||||||
/*
|
|
||||||
url = pointer to ASCIIZ URL
|
|
||||||
identifier = identifier of previously opened connection (keep-alive), or 0 to open a new one.
|
|
||||||
flags = bit flags (see end of this document).
|
|
||||||
add_header = pointer to ASCIIZ additional header parameters, or null for none.
|
|
||||||
Every additional parameter must end with CR LF bytes, including the last line.
|
|
||||||
Initiate a HTTP connection, using 'HEAD' method.
|
|
||||||
Returns NULL on error, identifier otherwise.
|
|
||||||
*/
|
|
||||||
extern http_msg * stdcall (*http_head)(const char *url, http_msg *identifier, unsigned flags, const char *add_header);
|
|
||||||
|
|
||||||
/*
|
|
||||||
url = pointer to ASCIIZ URL
|
|
||||||
identifier = identifier of previously opened connection (keep-alive), or 0 to open a new one.
|
|
||||||
flags = bit flags (see end of this document).
|
|
||||||
add_header = pointer to ASCIIZ additional header parameters, or null for none.
|
|
||||||
Every additional parameter must end with CR LF bytes, including the last line.
|
|
||||||
content-type = pointer to ASCIIZ string containing content type.
|
|
||||||
content-length = length of the content (in bytes).
|
|
||||||
Initiate a HTTP connection, using 'POST' method.
|
|
||||||
The content itself must be send to the socket (which you can find in the structure),
|
|
||||||
using system function 75, 6.
|
|
||||||
Returns 0 on error, identifier otherwise
|
|
||||||
*/
|
|
||||||
extern http_msg * stdcall (*http_post)(const char *url, http_msg *identifier, unsigned flags, const char *add_header,
|
|
||||||
const char *content_type, unsigned content_length);
|
|
||||||
|
|
||||||
/*
|
|
||||||
identifier = identifier which one of the previous functions returned
|
|
||||||
This procedure will handle all incoming data for a connection and place it in the buffer.
|
|
||||||
As long as the procedure expects more data, -1 is returned and the procedure must be called again.
|
|
||||||
When transfer is done, the procedure will return 0.
|
|
||||||
The receive procedure is non-blocking by default, but can be made to block by setting FLAG_BLOCK.
|
|
||||||
|
|
||||||
The HTTP header is placed together with some flags and other attributes in the http_msg structure.
|
|
||||||
This structure is defined in http.inc (and not copied here because it might still change.)
|
|
||||||
The identifier used by the functions is actually a pointer to this structure.
|
|
||||||
In the dword named .flags, the library will set various bit-flags indicating the status of the process.
|
|
||||||
(When a transfer is done, one should check these bit-flags to find out if the transfer was error-free.)
|
|
||||||
The HTTP header is placed at the end of this structure. The content is placed in another buffer.
|
|
||||||
The dword .status contains the status code received from the server (e.g. 200 for OK).
|
|
||||||
In header_length you'll find the length of the header as soon as it has been received.
|
|
||||||
In content_ptr you'll find a pointer to the actual content.
|
|
||||||
In content_length you'll find the length of the content.
|
|
||||||
In content_received, you'll find the number of content bytes already received.
|
|
||||||
*/
|
|
||||||
extern int stdcall (*http_receive)(http_msg *identifier);
|
|
||||||
|
|
||||||
/*
|
|
||||||
identifier = identifier which one of the previous functions returned
|
|
||||||
dataptr = pointer to the data you want to send
|
|
||||||
datalength = length of the data to send (in bytes)
|
|
||||||
This procedure can be used to send data to the server (POST)
|
|
||||||
Returns number of bytes sent, -1 on error
|
|
||||||
*/
|
|
||||||
extern int stdcall (*http_send)(http_msg *identifier, void *dataptr, unsigned datalength);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Sometimes the http_receive function receives incomplete data. If you have the same problem then a macro can help you:
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int stdcall (*http_free)(http_msg *identifier);
|
|
||||||
/*
|
|
||||||
Free unused data
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define http_long_receive(x) while(http_receive(x)){};
|
|
||||||
|
|
||||||
#endif // _HTTP_H_
|
|
@ -1,17 +0,0 @@
|
|||||||
/*
|
|
||||||
This is wrapper for Inputbox.obj sys library
|
|
||||||
https://board.kolibrios.org/viewtopic.php?f=24&t=3767&sid=fd2ca95b24eec430db0c61d977f5d8ba#p71585
|
|
||||||
|
|
||||||
Adapted for TCC's dynamic API by Magomed Kostoev, 2020
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __KOS__INPUTBOX__H________
|
|
||||||
#define __KOS__INPUTBOX__H________
|
|
||||||
|
|
||||||
#define cdecl __attribute__ ((cdecl))
|
|
||||||
#define stdcall __attribute__ ((stdcall))
|
|
||||||
|
|
||||||
extern unsigned stdcall (*InputBox)(void* Buffer, char* Caption, char* Prompt, char* Default,
|
|
||||||
unsigned long Flags, unsigned long BufferSize, void* RedrawProc);
|
|
||||||
|
|
||||||
#endif // __KOS__INPUTBOX__H________
|
|
@ -1,126 +0,0 @@
|
|||||||
/* Written by turbocat2001 (Logaev Maxim) */
|
|
||||||
|
|
||||||
#ifndef KOLIBRI_LIBIMG_H
|
|
||||||
#define KOLIBRI_LIBIMG_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
extern int kolibri_libimg_init(void);
|
|
||||||
|
|
||||||
#define _stdcall __attribute__((__stdcall__))
|
|
||||||
|
|
||||||
//list of format id's
|
|
||||||
#define LIBIMG_FORMAT_BMP 1
|
|
||||||
#define LIBIMG_FORMAT_ICO 2
|
|
||||||
#define LIBIMG_FORMAT_CUR 3
|
|
||||||
#define LIBIMG_FORMAT_GIF 4
|
|
||||||
#define LIBIMG_FORMAT_PNG 5
|
|
||||||
#define LIBIMG_FORMAT_JPEG 6
|
|
||||||
#define LIBIMG_FORMAT_TGA 7
|
|
||||||
#define LIBIMG_FORMAT_PCX 8
|
|
||||||
#define LIBIMG_FORMAT_XCF 9
|
|
||||||
#define LIBIMG_FORMAT_TIFF 10
|
|
||||||
#define LIBIMG_FORMAT_PNM 11
|
|
||||||
#define LIBIMG_FORMAT_WBMP 12
|
|
||||||
#define LIBIMG_FORMAT_XBM 13
|
|
||||||
#define LIBIMG_FORMAT_Z80 14
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
typedef struct{
|
|
||||||
uint32_t Checksum; // ((Width ROL 16) OR Height) XOR Data[0] ; ignored so far
|
|
||||||
uint32_t Width;
|
|
||||||
uint32_t Height;
|
|
||||||
uint32_t Next;
|
|
||||||
uint32_t Previous;
|
|
||||||
uint32_t Type; // one of Image.bppN
|
|
||||||
uint32_t* Data;
|
|
||||||
uint32_t Palette; // used iff Type eq Image.bpp1, Image.bpp2, Image.bpp4 or Image.bpp8i
|
|
||||||
uint32_t Extended;
|
|
||||||
uint32_t Flags; // bitfield
|
|
||||||
uint32_t Delay; // used iff Image.IsAnimated is set in Flags
|
|
||||||
} Image;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
#define IMAGE_BPP8i 1 // indexed
|
|
||||||
#define IMAGE_BPP24 2
|
|
||||||
#define IMAGE_BPP32 3
|
|
||||||
#define IMAGE_BPP15 4
|
|
||||||
#define IMAGE_BPP16 5
|
|
||||||
#define IMAGE_BPP1 6
|
|
||||||
#define IMAGE_BPP8g 7 // grayscale
|
|
||||||
#define IMAGE_BPP2i 8
|
|
||||||
#define IMAGE_BPP4i 9
|
|
||||||
#define IMAGE_BPP8a 10
|
|
||||||
|
|
||||||
// scale type
|
|
||||||
#define LIBIMG_SCALE_NONE 0
|
|
||||||
#define LIBIMG_SCALE_INTEGER 1
|
|
||||||
#define LIBIMG_SCALE_TILE 2
|
|
||||||
#define LIBIMG_SCALE_STRETCH 3
|
|
||||||
#define LIBIMG_SCALE_FIT_BOTH LIBIMG_SCALE_STRETCH
|
|
||||||
#define LIBIMG_SCALE_FIT_MIN 4
|
|
||||||
#define LIBIMG_SCALE_FIT_RECT LIBIMG_SCALE_FIT_MIN
|
|
||||||
#define LIBIMG_SCALE_FIT_WIDTH 5
|
|
||||||
#define LIBIMG_SCALE_FIT_HEIGHT 6
|
|
||||||
#define LIBIMG_SCALE_FIT_MAX 7
|
|
||||||
|
|
||||||
// interpolation algorithm
|
|
||||||
#define LIBIMG_INTER_NONE 0 // use it with LIBIMG_SCALE_INTEGER, LIBIMG_SCALE_TILE, etc
|
|
||||||
#define LIBIMG_INTER_BILINEAR 1
|
|
||||||
#define LIBIMG_INTER_BICUBIC 2
|
|
||||||
#define LIBIMG_INTER_LANCZOS 3
|
|
||||||
#define LIBIMG_INTER_DEFAULT LIBIMG_INTER_BILINEAR
|
|
||||||
|
|
||||||
//error codes
|
|
||||||
#define LIBIMG_ERROR_OUT_OF_MEMORY 1
|
|
||||||
#define LIBIMG_ERROR_FORMAT 2
|
|
||||||
#define LIBIMG_ERROR_CONDITIONS 3
|
|
||||||
#define LIBIMG_ERROR_BIT_DEPTH 4
|
|
||||||
#define LIBIMG_ERROR_ENCODER 5
|
|
||||||
#define LIBIMG_ERROR_SRC_TYPE 6
|
|
||||||
#define LIBIMG_ERROR_SCALE 7
|
|
||||||
#define LIBIMG_ERROR_INTER 8
|
|
||||||
#define LIBIMG_ERROR_NOT_INPLEMENTED 9
|
|
||||||
#define LIBIMG_ERROR_INVALID_INPUT 10
|
|
||||||
|
|
||||||
//encode flags (byte 0x02 of _common option)
|
|
||||||
#define LIBIMG_ENCODE_STRICT_SPECIFIC 0x01
|
|
||||||
#define LIBIMG_ENCODE_STRICT_BIT_DEPTH 0x02
|
|
||||||
#define LIBIMG_ENCODE_DELETE_ALPHA 0x08
|
|
||||||
#define LIBIMG_ENCODE_FLUSH_ALPHA 0x10
|
|
||||||
|
|
||||||
#define FLIP_VERTICAL 0x01
|
|
||||||
#define FLIP_HORIZONTAL 0x02
|
|
||||||
|
|
||||||
#define ROTATE_90_CW 0x01
|
|
||||||
#define ROTATE_180 0x02
|
|
||||||
#define ROTATE_270_CW 0x03
|
|
||||||
#define ROTATE_90_CCW ROTATE_270_CW
|
|
||||||
#define ROTATE_270_CCW ROTATE_90_CW
|
|
||||||
|
|
||||||
extern Image* (*img_decode _stdcall)(void* file_data, uint32_t size, uint32_t b_color);
|
|
||||||
extern Image* (*img_encode _stdcall)(Image* img, uint32_t length, uint32_t option);
|
|
||||||
extern Image* (*img_create _stdcall)(uint32_t width, uint32_t height, uint32_t type);
|
|
||||||
extern void (*img_to_rgb2 _stdcall)(Image* img, void *rgb_data);
|
|
||||||
extern Image* (*img_to_rgb _stdcall)(Image* img);
|
|
||||||
extern bool (*img_flip _stdcall)(Image* img, uint32_t flip);
|
|
||||||
extern bool (*img_flip_layer _stdcall)(Image *img, uint32_t flip);
|
|
||||||
extern bool (*img_rotate _stdcall)(Image *img, uint32_t rotate);
|
|
||||||
extern bool (*img_rotate_layer _stdcall)(Image* data, uint32_t rotate);
|
|
||||||
extern void (*img_draw _stdcall)(Image *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t xoff, uint32_t yoff);
|
|
||||||
extern int32_t (*img_count _stdcall)(Image *img);
|
|
||||||
extern bool (*img_destroy _stdcall)(Image *img);
|
|
||||||
extern bool (*img_destroy_layer _stdcall)(Image* img);
|
|
||||||
extern Image* (*img_blend _stdcall)(Image* dst, Image* src, uint32_t out_x, uint32_t out_y, uint32_t in_x, uint32_t in_y, uint32_t width, uint32_t height);
|
|
||||||
extern Image* (*img_convert _stdcall)(Image *src, Image *dst, uint32_t dst_type, uint32_t, uint32_t);
|
|
||||||
extern Image* (*img_resize_data _stdcall)(Image *src, uint32_t width, uint32_t height);
|
|
||||||
extern Image* (*img_scale _stdcall)(Image* src, uint32_t crop_x, uint32_t crop_y, uint32_t crop_width, uint32_t crop_height, Image* dst, uint32_t scale_type, uint32_t inter, uint32_t new_width, uint32_t new_height);
|
|
||||||
|
|
||||||
void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color){
|
|
||||||
for (uint32_t i = 0; i < width*height; i++) {
|
|
||||||
img->Data[i] = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* KOLIBRI_LIBIMG_H */
|
|
@ -1,55 +0,0 @@
|
|||||||
#ifndef KOLIBRI_MSGBOX_H
|
|
||||||
#define KOLIBRI_MSGBOX_H
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
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 __attribute__((__stdcall__)))(msgbox *, void *thread); // clears callbacks, ! if fix lib, we can return eax as of Fn51
|
|
||||||
extern void (*msgbox_setfunctions __attribute__((__stdcall__)))(msgbox_callback*); // must be called immediately after create, zero-ended array
|
|
||||||
extern void (*msgbox_reinit __attribute__((__stdcall__)))(msgbox *) ; // 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
|
|
@ -1,11 +0,0 @@
|
|||||||
#ifndef KOLIBRI_RASTERWORKS_H
|
|
||||||
#define KOLIBRI_RASTERWORKS_H
|
|
||||||
|
|
||||||
//extern int kolibri_rasterworks_init(void);
|
|
||||||
|
|
||||||
extern void (*drawText __attribute__((__stdcall__)))(void *canvas, int x, int y, const char *string, int charQuantity, int fontColor, int params);
|
|
||||||
extern int (*countUTF8Z __attribute__((__stdcall__)))(const char *string, int byteQuantity);
|
|
||||||
extern int (*charsFit __attribute__((__stdcall__)))(int areaWidth, int charHeight);
|
|
||||||
extern int (*strWidth __attribute__((__stdcall__)))(int charQuantity, int charHeight);
|
|
||||||
|
|
||||||
#endif /* KOLIBRI_RASTERWORKS_H */
|
|
@ -1,203 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
This is adapded thunk for console.obj sys library
|
|
||||||
.h is equal to svn:\programs\develop\libraries\console\console_en.txt
|
|
||||||
|
|
||||||
Adapted for tcc by Siemargl, 2016
|
|
||||||
|
|
||||||
*/
|
|
||||||
#ifndef __conio_h
|
|
||||||
#define __conio_h
|
|
||||||
|
|
||||||
#define cdecl __attribute__ ((cdecl))
|
|
||||||
#define stdcall __attribute__ ((stdcall))
|
|
||||||
|
|
||||||
/*
|
|
||||||
console.obj exports the following functions
|
|
||||||
*/
|
|
||||||
typedef unsigned int dword; /* 32-bit unsigned integer */
|
|
||||||
typedef unsigned short word; /* 16-bit unsigned integer */
|
|
||||||
|
|
||||||
extern void stdcall (*con_init)(dword wnd_width, dword wnd_height,
|
|
||||||
dword scr_width, dword scr_height, const char* title);
|
|
||||||
/* Console initialization. Must be called only once.
|
|
||||||
wnd_width, wnd_height - width and height (in units of characters) of the visible
|
|
||||||
region;
|
|
||||||
scr_width, scr_height - width and height (in units of characters) of console;
|
|
||||||
Any of these four parameters can be set to -1 (=0xFFFFFFFF)
|
|
||||||
to use the library's default values;
|
|
||||||
title - console window's caption. */
|
|
||||||
|
|
||||||
extern void stdcall (*con_exit)(int bCloseWindow);
|
|
||||||
/* You should call this funstion at the end of the program.
|
|
||||||
If bCloseWindow is zero, the string "[Finished]" will be added to the caption of
|
|
||||||
the window and the console window will remain on the screen until the user
|
|
||||||
closes it. */
|
|
||||||
|
|
||||||
extern void stdcall (*con_set_title)(const char* title);
|
|
||||||
/* Set new window caption. */
|
|
||||||
|
|
||||||
extern void stdcall (*con_write_asciiz)(const char* str);
|
|
||||||
/* Display ASCIIZ-string to the console at the current position, shifting
|
|
||||||
the current position. */
|
|
||||||
|
|
||||||
extern void stdcall (*con_write_string)(const char* str, dword length);
|
|
||||||
/* Similar to con_write_asciiz, but length of the string must be given as a
|
|
||||||
separate parameter */
|
|
||||||
|
|
||||||
extern int cdecl (*con_printf)(const char* format, ...);
|
|
||||||
/* Standard "printf" function from ANSI C. */
|
|
||||||
|
|
||||||
extern dword stdcall (*con_get_flags)(void);
|
|
||||||
/* Get output flags. */
|
|
||||||
|
|
||||||
extern dword stdcall (*con_set_flags)(dword new_flags);
|
|
||||||
/* Set output flags. This function returns previous values. */
|
|
||||||
|
|
||||||
/* Flags (bitmask): */
|
|
||||||
/* text color */
|
|
||||||
#define CON_COLOR_BLUE 0x01
|
|
||||||
#define CON_COLOR_GREEN 0x02
|
|
||||||
#define CON_COLOR_RED 0x04
|
|
||||||
#define CON_COLOR_BRIGHT 0x08
|
|
||||||
/* background color */
|
|
||||||
#define CON_BGR_BLUE 0x10
|
|
||||||
#define CON_BGR_GREEN 0x20
|
|
||||||
#define CON_BGR_RED 0x40
|
|
||||||
#define CON_BGR_BRIGHT 0x80
|
|
||||||
/* output controls */
|
|
||||||
#define CON_IGNORE_SPECIALS 0x100
|
|
||||||
/* if this flag is cleared, function interprets special characters:
|
|
||||||
10 ('\n') - next line
|
|
||||||
13 ('\r') - carriage return
|
|
||||||
8 ('\b') - backspace
|
|
||||||
9 ('\t') - tab
|
|
||||||
27 ('\033' = '\x1B') - the beginning of Esc-sequences;
|
|
||||||
otherwise, these characters will be displayed like ordinary characters. */
|
|
||||||
/* Supported Esc-sequences:
|
|
||||||
Esc[<number1>;<number2>;<number3>m - choice of character attributes:
|
|
||||||
You can specify one, two or three codes in any order;
|
|
||||||
0 = normal mode (white on black)
|
|
||||||
1 = bright selection
|
|
||||||
5 = bright background
|
|
||||||
7 = inverse mode (black on white)
|
|
||||||
30 = black characters
|
|
||||||
31 = red characters
|
|
||||||
32 = green characters
|
|
||||||
33 = brown characters
|
|
||||||
34 = blue characters
|
|
||||||
35 = purple characters
|
|
||||||
36 = turqoise characters
|
|
||||||
37 = white characters
|
|
||||||
40 = black background
|
|
||||||
41 = red background
|
|
||||||
42 = green background
|
|
||||||
43 = brown background
|
|
||||||
44 = blue background
|
|
||||||
45 = purple background
|
|
||||||
46 = turqoise background
|
|
||||||
47 = white background
|
|
||||||
The following sequences appeared in version 5 of library:
|
|
||||||
Esc[2J - clear screen, move cursor to upper left corner
|
|
||||||
Esc[<number1>;<number2>H = Esc[<number1>;<number2>f -
|
|
||||||
move cursor to <number1>,<number2>
|
|
||||||
Esc[<number>A - move cursor to <number> lines up
|
|
||||||
Esc[<number>B - move cursor to <number> lines down
|
|
||||||
Esc[<number>C - move cursor to <number> positions right
|
|
||||||
Esc[<number>D - move cursor to <number> positions left
|
|
||||||
*/
|
|
||||||
/* signal "console closed"; appeared in version 6;
|
|
||||||
ignored by con_set_flags */
|
|
||||||
#define CON_WINDOW_CLOSED 0x200
|
|
||||||
/* The default value for flags = 7. (grey text on black background) */
|
|
||||||
|
|
||||||
extern int stdcall (*con_get_font_height)(void);
|
|
||||||
/* Get the height of the font. */
|
|
||||||
|
|
||||||
extern int stdcall (*con_get_cursor_height)(void);
|
|
||||||
/* Get the height of the cursor. */
|
|
||||||
|
|
||||||
extern int stdcall (*con_set_cursor_height)(int new_height);
|
|
||||||
/* Set the height of the cursor. This function returns previous value.
|
|
||||||
An attempt to set the value out of the correct interval (from 0 to
|
|
||||||
font_height-1) is ignored.
|
|
||||||
Cursor with zero height isn't displayed.
|
|
||||||
Default value: - 15% from font height. */
|
|
||||||
|
|
||||||
extern int stdcall (*con_getch)(void);
|
|
||||||
/* Get one character from the keyboard.
|
|
||||||
|
|
||||||
For normal characters function returns ASCII-code. For extended
|
|
||||||
characters (eg, Fx, and arrows), first function call returns 0
|
|
||||||
and second call returns the extended code (similar to the DOS-function
|
|
||||||
input). Starting from version 7, after closing the console window,
|
|
||||||
this function returns 0. */
|
|
||||||
|
|
||||||
extern word stdcall (*con_getch2)(void);
|
|
||||||
/* Reads a character from the keyboard. Low byte contains the ASCII-code
|
|
||||||
(0 for extended characters), high byte - advanced code (like in BIOS
|
|
||||||
input functions). Starting from version 7, after closing the console
|
|
||||||
window, this function returns 0. */
|
|
||||||
|
|
||||||
extern int stdcall (*con_kbhit)(void);
|
|
||||||
/* Returns 1 if a key was pressed, 0 otherwise. To read pressed keys use
|
|
||||||
con_getch and con_getch2. Starting from version 6, after closing
|
|
||||||
the console window, this function returns 1. */
|
|
||||||
|
|
||||||
extern char* stdcall (*con_gets)(char* str, int n);
|
|
||||||
/* Reads a string from the keyboard. Reading is interrupted when got
|
|
||||||
"new line" character, or after reading the (n-1) characters (depending on
|
|
||||||
what comes first). In the first case the newline is also recorded in the
|
|
||||||
str. The acquired line is complemented by a null character.
|
|
||||||
Starting from version 6, the function returns a pointer to the entered
|
|
||||||
line if reading was successful, and NULL if the console window was closed. */
|
|
||||||
|
|
||||||
typedef int (stdcall * con_gets2_callback)(int keycode, char** pstr, int* pn,
|
|
||||||
int* ppos);
|
|
||||||
|
|
||||||
extern char* stdcall (*con_gets2)(con_gets2_callback callback, char* str, int n);
|
|
||||||
/* Con_gets completely analogous, except that when the user
|
|
||||||
press unrecognized key, it calls the specified callback-procedure
|
|
||||||
(which may, for example, handle up / down for history and tab to enter
|
|
||||||
autocompletion). You should pass to the procedure: key code and three pointers
|
|
||||||
- to the string, to the maximum length and to the current position.
|
|
||||||
function may change the contents of string and may change the string
|
|
||||||
itself (for example, to reallocate memory for increase the limit),
|
|
||||||
maximum length, and position of the line - pointers are passed for it.
|
|
||||||
Return value: 0 = line wasn't changed 1 = line changed, you should
|
|
||||||
remove old string and display new, 2 = line changed, it is necessary
|
|
||||||
to display it; 3 = immediately exit the function.
|
|
||||||
Starting from version 6, the function returns a pointer to the entered
|
|
||||||
line with the successful reading, and NULL if the console window was closed. */
|
|
||||||
|
|
||||||
extern void stdcall (*con_cls)();
|
|
||||||
/* Clear screen and set cursor at upper left corner. */
|
|
||||||
|
|
||||||
|
|
||||||
extern void stdcall (*con_get_cursor_pos)(int* px, int* py);
|
|
||||||
/* Wrote current (x) coordinate of cursor to *px, and (y) to *py. */
|
|
||||||
|
|
||||||
extern void stdcall (*con_set_cursor_pos)(int x, int y);
|
|
||||||
/* Set the cursor position to the specified coordinates. If any of the
|
|
||||||
parameters beyond the relevant range (from 0 to 1 scr_width-
|
|
||||||
for x, from 0 to 1 for scr_height-y, scr_width scr_height and were asked if
|
|
||||||
call con_init), then the corresponding coordinate of the cursor does not change.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int __console_initdll_status;
|
|
||||||
/* == 1 if dll loaded */
|
|
||||||
|
|
||||||
extern dword *con_dll_ver;
|
|
||||||
|
|
||||||
extern int con_init_console_dll(void);
|
|
||||||
/* load library and link function symbols. returns 1 if error
|
|
||||||
called automatic in printf, otherwise, see __console_initdll_status
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int con_init_console_dll_param(dword wnd_width, dword wnd_height,
|
|
||||||
dword scr_width, dword scr_height, const char* title);
|
|
||||||
/* work as con_init_console_dll, but call con_init with params
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,123 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: aes.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding AES implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef AES_H
|
|
||||||
#define AES_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
|
||||||
#define AES_BLOCK_SIZE 16 // AES operates on 16 bytes at a time
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
///////////////////
|
|
||||||
// AES
|
|
||||||
///////////////////
|
|
||||||
// Key setup must be done before any AES en/de-cryption functions can be used.
|
|
||||||
void aes_key_setup(const BYTE key[], // The key, must be 128, 192, or 256 bits
|
|
||||||
WORD w[], // Output key schedule to be used later
|
|
||||||
int keysize); // Bit length of the key, 128, 192, or 256
|
|
||||||
|
|
||||||
void aes_encrypt(const BYTE in[], // 16 bytes of plaintext
|
|
||||||
BYTE out[], // 16 bytes of ciphertext
|
|
||||||
const WORD key[], // From the key setup
|
|
||||||
int keysize); // Bit length of the key, 128, 192, or 256
|
|
||||||
|
|
||||||
void aes_decrypt(const BYTE in[], // 16 bytes of ciphertext
|
|
||||||
BYTE out[], // 16 bytes of plaintext
|
|
||||||
const WORD key[], // From the key setup
|
|
||||||
int keysize); // Bit length of the key, 128, 192, or 256
|
|
||||||
|
|
||||||
///////////////////
|
|
||||||
// AES - CBC
|
|
||||||
///////////////////
|
|
||||||
int aes_encrypt_cbc(const BYTE in[], // Plaintext
|
|
||||||
size_t in_len, // Must be a multiple of AES_BLOCK_SIZE
|
|
||||||
BYTE out[], // Ciphertext, same length as plaintext
|
|
||||||
const WORD key[], // From the key setup
|
|
||||||
int keysize, // Bit length of the key, 128, 192, or 256
|
|
||||||
const BYTE iv[]); // IV, must be AES_BLOCK_SIZE bytes long
|
|
||||||
|
|
||||||
// Only output the CBC-MAC of the input.
|
|
||||||
int aes_encrypt_cbc_mac(const BYTE in[], // plaintext
|
|
||||||
size_t in_len, // Must be a multiple of AES_BLOCK_SIZE
|
|
||||||
BYTE out[], // Output MAC
|
|
||||||
const WORD key[], // From the key setup
|
|
||||||
int keysize, // Bit length of the key, 128, 192, or 256
|
|
||||||
const BYTE iv[]); // IV, must be AES_BLOCK_SIZE bytes long
|
|
||||||
|
|
||||||
///////////////////
|
|
||||||
// AES - CTR
|
|
||||||
///////////////////
|
|
||||||
void increment_iv(BYTE iv[], // Must be a multiple of AES_BLOCK_SIZE
|
|
||||||
int counter_size); // Bytes of the IV used for counting (low end)
|
|
||||||
|
|
||||||
void aes_encrypt_ctr(const BYTE in[], // Plaintext
|
|
||||||
size_t in_len, // Any byte length
|
|
||||||
BYTE out[], // Ciphertext, same length as plaintext
|
|
||||||
const WORD key[], // From the key setup
|
|
||||||
int keysize, // Bit length of the key, 128, 192, or 256
|
|
||||||
const BYTE iv[]); // IV, must be AES_BLOCK_SIZE bytes long
|
|
||||||
|
|
||||||
void aes_decrypt_ctr(const BYTE in[], // Ciphertext
|
|
||||||
size_t in_len, // Any byte length
|
|
||||||
BYTE out[], // Plaintext, same length as ciphertext
|
|
||||||
const WORD key[], // From the key setup
|
|
||||||
int keysize, // Bit length of the key, 128, 192, or 256
|
|
||||||
const BYTE iv[]); // IV, must be AES_BLOCK_SIZE bytes long
|
|
||||||
|
|
||||||
///////////////////
|
|
||||||
// AES - CCM
|
|
||||||
///////////////////
|
|
||||||
// Returns True if the input parameters do not violate any constraint.
|
|
||||||
int aes_encrypt_ccm(const BYTE plaintext[], // IN - Plaintext.
|
|
||||||
WORD plaintext_len, // IN - Plaintext length.
|
|
||||||
const BYTE associated_data[], // IN - Associated Data included in authentication, but not encryption.
|
|
||||||
unsigned short associated_data_len, // IN - Associated Data length in bytes.
|
|
||||||
const BYTE nonce[], // IN - The Nonce to be used for encryption.
|
|
||||||
unsigned short nonce_len, // IN - Nonce length in bytes.
|
|
||||||
BYTE ciphertext[], // OUT - Ciphertext, a concatination of the plaintext and the MAC.
|
|
||||||
WORD *ciphertext_len, // OUT - The length of the ciphertext, always plaintext_len + mac_len.
|
|
||||||
WORD mac_len, // IN - The desired length of the MAC, must be 4, 6, 8, 10, 12, 14, or 16.
|
|
||||||
const BYTE key[], // IN - The AES key for encryption.
|
|
||||||
int keysize); // IN - The length of the key in bits. Valid values are 128, 192, 256.
|
|
||||||
|
|
||||||
// Returns True if the input parameters do not violate any constraint.
|
|
||||||
// Use mac_auth to ensure decryption/validation was preformed correctly.
|
|
||||||
// If authentication does not succeed, the plaintext is zeroed out. To overwride
|
|
||||||
// this, call with mac_auth = NULL. The proper proceedure is to decrypt with
|
|
||||||
// authentication enabled (mac_auth != NULL) and make a second call to that
|
|
||||||
// ignores authentication explicitly if the first call failes.
|
|
||||||
int aes_decrypt_ccm(const BYTE ciphertext[], // IN - Ciphertext, the concatination of encrypted plaintext and MAC.
|
|
||||||
WORD ciphertext_len, // IN - Ciphertext length in bytes.
|
|
||||||
const BYTE assoc[], // IN - The Associated Data, required for authentication.
|
|
||||||
unsigned short assoc_len, // IN - Associated Data length in bytes.
|
|
||||||
const BYTE nonce[], // IN - The Nonce to use for decryption, same one as for encryption.
|
|
||||||
unsigned short nonce_len, // IN - Nonce length in bytes.
|
|
||||||
BYTE plaintext[], // OUT - The plaintext that was decrypted. Will need to be large enough to hold ciphertext_len - mac_len.
|
|
||||||
WORD *plaintext_len, // OUT - Length in bytes of the output plaintext, always ciphertext_len - mac_len .
|
|
||||||
WORD mac_len, // IN - The length of the MAC that was calculated.
|
|
||||||
int *mac_auth, // OUT - TRUE if authentication succeeded, FALSE if it did not. NULL pointer will ignore the authentication.
|
|
||||||
const BYTE key[], // IN - The AES key for decryption.
|
|
||||||
int keysize); // IN - The length of the key in BITS. Valid values are 128, 192, 256.
|
|
||||||
|
|
||||||
///////////////////
|
|
||||||
// Test functions
|
|
||||||
///////////////////
|
|
||||||
int aes_test();
|
|
||||||
int aes_ecb_test();
|
|
||||||
int aes_cbc_test();
|
|
||||||
int aes_ctr_test();
|
|
||||||
int aes_ccm_test();
|
|
||||||
|
|
||||||
#endif // AES_H
|
|
@ -1,30 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: arcfour.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding ARCFOUR implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef ARCFOUR_H
|
|
||||||
#define ARCFOUR_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
// Input: state - the state used to generate the keystream
|
|
||||||
// key - Key to use to initialize the state
|
|
||||||
// len - length of key in bytes (valid lenth is 1 to 256)
|
|
||||||
void arcfour_key_setup(BYTE state[], const BYTE key[], int len);
|
|
||||||
|
|
||||||
// Pseudo-Random Generator Algorithm
|
|
||||||
// Input: state - the state used to generate the keystream
|
|
||||||
// out - Must be allocated to be of at least "len" length
|
|
||||||
// len - number of bytes to generate
|
|
||||||
void arcfour_generate_stream(BYTE state[], BYTE out[], size_t len);
|
|
||||||
|
|
||||||
#endif // ARCFOUR_H
|
|
@ -1,27 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: base64.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding Base64 implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef BASE64_H
|
|
||||||
#define BASE64_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
// Returns the size of the output. If called with out = NULL, will just return
|
|
||||||
// the size of what the output would have been (without a terminating NULL).
|
|
||||||
size_t base64_encode(const BYTE in[], BYTE out[], size_t len, int newline_flag);
|
|
||||||
|
|
||||||
// Returns the size of the output. If called with out = NULL, will just return
|
|
||||||
// the size of what the output would have been (without a terminating NULL).
|
|
||||||
size_t base64_decode(const BYTE in[], BYTE out[], size_t len);
|
|
||||||
|
|
||||||
#endif // BASE64_H
|
|
@ -1,32 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: blowfish.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding Blowfish implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef BLOWFISH_H
|
|
||||||
#define BLOWFISH_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
|
||||||
#define BLOWFISH_BLOCK_SIZE 8 // Blowfish operates on 8 bytes at a time
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
WORD p[18];
|
|
||||||
WORD s[4][256];
|
|
||||||
} BLOWFISH_KEY;
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
void blowfish_key_setup(const BYTE user_key[], BLOWFISH_KEY *keystruct, size_t len);
|
|
||||||
void blowfish_encrypt(const BYTE in[], BYTE out[], const BLOWFISH_KEY *keystruct);
|
|
||||||
void blowfish_decrypt(const BYTE in[], BYTE out[], const BLOWFISH_KEY *keystruct);
|
|
||||||
|
|
||||||
#endif // BLOWFISH_H
|
|
@ -1,37 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: des.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding DES implementation.
|
|
||||||
Note that encryption and decryption are defined by how
|
|
||||||
the key setup is performed, the actual en/de-cryption is
|
|
||||||
performed by the same function.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef DES_H
|
|
||||||
#define DESH
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
|
||||||
#define DES_BLOCK_SIZE 8 // DES operates on 8 bytes at a time
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
DES_ENCRYPT,
|
|
||||||
DES_DECRYPT
|
|
||||||
} DES_MODE;
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
void des_key_setup(const BYTE key[], BYTE schedule[][6], DES_MODE mode);
|
|
||||||
void des_crypt(const BYTE in[], BYTE out[], const BYTE key[][6]);
|
|
||||||
|
|
||||||
void three_des_key_setup(const BYTE key[], BYTE schedule[][16][6], DES_MODE mode);
|
|
||||||
void three_des_crypt(const BYTE in[], BYTE out[], const BYTE key[][16][6]);
|
|
||||||
|
|
||||||
#endif // DES_H
|
|
@ -1,33 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: md2.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding MD2 implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef MD2_H
|
|
||||||
#define MD2_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
|
||||||
#define MD2_BLOCK_SIZE 16
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BYTE data[16];
|
|
||||||
BYTE state[48];
|
|
||||||
BYTE checksum[16];
|
|
||||||
int len;
|
|
||||||
} MD2_CTX;
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
void md2_init(MD2_CTX *ctx);
|
|
||||||
void md2_update(MD2_CTX *ctx, const BYTE data[], size_t len);
|
|
||||||
void md2_final(MD2_CTX *ctx, BYTE hash[]); // size of hash must be MD2_BLOCK_SIZE
|
|
||||||
|
|
||||||
#endif // MD2_H
|
|
@ -1,34 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: md5.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding MD5 implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef MD5_H
|
|
||||||
#define MD5_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
|
||||||
#define MD5_BLOCK_SIZE 16 // MD5 outputs a 16 byte digest
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BYTE data[64];
|
|
||||||
WORD datalen;
|
|
||||||
unsigned long long bitlen;
|
|
||||||
WORD state[4];
|
|
||||||
} MD5_CTX;
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
void md5_init(MD5_CTX *ctx);
|
|
||||||
void md5_update(MD5_CTX *ctx, const BYTE data[], size_t len);
|
|
||||||
void md5_final(MD5_CTX *ctx, BYTE hash[]);
|
|
||||||
|
|
||||||
#endif // MD5_H
|
|
@ -1,20 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: rot-13.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding ROT-13 implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef ROT13_H
|
|
||||||
#define ROT13_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
// Performs IN PLACE rotation of the input. Assumes input is NULL terminated.
|
|
||||||
// Preserves each charcter's case. Ignores non alphabetic characters.
|
|
||||||
void rot13(char str[]);
|
|
||||||
|
|
||||||
#endif // ROT13_H
|
|
@ -1,35 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: sha1.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding SHA1 implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef SHA1_H
|
|
||||||
#define SHA1_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
|
||||||
#define SHA1_BLOCK_SIZE 20 // SHA1 outputs a 20 byte digest
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BYTE data[64];
|
|
||||||
WORD datalen;
|
|
||||||
unsigned long long bitlen;
|
|
||||||
WORD state[5];
|
|
||||||
WORD k[4];
|
|
||||||
} SHA1_CTX;
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
void sha1_init(SHA1_CTX *ctx);
|
|
||||||
void sha1_update(SHA1_CTX *ctx, const BYTE data[], size_t len);
|
|
||||||
void sha1_final(SHA1_CTX *ctx, BYTE hash[]);
|
|
||||||
|
|
||||||
#endif // SHA1_H
|
|
@ -1,34 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Filename: sha256.h
|
|
||||||
* Author: Brad Conte (brad AT bradconte.com)
|
|
||||||
* Copyright:
|
|
||||||
* Disclaimer: This code is presented "as is" without any guarantees.
|
|
||||||
* Details: Defines the API for the corresponding SHA1 implementation.
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#ifndef SHA256_H
|
|
||||||
#define SHA256_H
|
|
||||||
|
|
||||||
/*************************** HEADER FILES ***************************/
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
|
||||||
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
|
|
||||||
|
|
||||||
/**************************** DATA TYPES ****************************/
|
|
||||||
typedef unsigned char BYTE; // 8-bit byte
|
|
||||||
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BYTE data[64];
|
|
||||||
WORD datalen;
|
|
||||||
unsigned long long bitlen;
|
|
||||||
WORD state[8];
|
|
||||||
} SHA256_CTX;
|
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
|
||||||
void sha256_init(SHA256_CTX *ctx);
|
|
||||||
void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len);
|
|
||||||
void sha256_final(SHA256_CTX *ctx, BYTE hash[]);
|
|
||||||
|
|
||||||
#endif // SHA256_H
|
|
@ -1,41 +0,0 @@
|
|||||||
#ifndef _CTYPE_H
|
|
||||||
#define _CTYPE_H
|
|
||||||
/*
|
|
||||||
** All character classification functions except isascii().
|
|
||||||
** Integer argument (c) must be in ASCII range (0-127) for
|
|
||||||
** dependable answers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define __ALNUM 1
|
|
||||||
#define __ALPHA 2
|
|
||||||
#define __CNTRL 4
|
|
||||||
#define __DIGIT 8
|
|
||||||
#define __GRAPH 16
|
|
||||||
#define __LOWER 32
|
|
||||||
#define __PRINT 64
|
|
||||||
#define __PUNCT 128
|
|
||||||
#define __BLANK 256
|
|
||||||
#define __UPPER 512
|
|
||||||
#define __XDIGIT 1024
|
|
||||||
|
|
||||||
extern unsigned short __is[129];
|
|
||||||
|
|
||||||
#define isalnum(c)(__is[c+1] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */
|
|
||||||
#define isalpha(c)(__is[c+1] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */
|
|
||||||
#define iscntrl(c)(__is[c+1] & __CNTRL ) /* 0-31, 127 */
|
|
||||||
#define isdigit(c)(__is[c+1] & __DIGIT ) /* '0'-'9' */
|
|
||||||
#define isgraph(c)(__is[c+1] & __GRAPH ) /* '!'-'~' */
|
|
||||||
#define islower(c)(__is[c+1] & __LOWER ) /* 'a'-'z' */
|
|
||||||
#define isprint(c)(__is[c+1] & __PRINT ) /* ' '-'~' */
|
|
||||||
#define ispunct(c)(__is[c+1] & __PUNCT ) /* !alnum && !cntrl && !space */
|
|
||||||
#define isspace(c)(__is[c+1] & __BLANK ) /* HT, LF, VT, FF, CR, ' ' */
|
|
||||||
#define isupper(c)(__is[c+1] & __UPPER ) /* 'A'-'Z' */
|
|
||||||
#define isxdigit(c)(__is[c+1] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
|
|
||||||
|
|
||||||
#define isascii(c) (!((c)&(~0x7f)))
|
|
||||||
#define toascii(c) ((c)&0x7f)
|
|
||||||
|
|
||||||
extern unsigned char tolower(unsigned char c);
|
|
||||||
extern unsigned char toupper(unsigned char c);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,35 +0,0 @@
|
|||||||
#ifndef _DIR_H
|
|
||||||
#define _DIR_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#define rmfile(obj) rmdir(obj)
|
|
||||||
#define PATH_MAX 4096
|
|
||||||
#define T_FOLDER 16
|
|
||||||
#define T_FILE 0
|
|
||||||
#define FS_ERROR -1
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned type;
|
|
||||||
char *name;
|
|
||||||
} short_file_info;
|
|
||||||
|
|
||||||
//Writes information about files in the "dir" folder to an struct array"list". Returns the number of files.
|
|
||||||
int lsdir(const char* dir, short_file_info **list);
|
|
||||||
|
|
||||||
// Get the path to the working directory(if buf is NULL, then memory will be allocated automatically)
|
|
||||||
char *getcwd(char *buf, unsigned size);
|
|
||||||
|
|
||||||
// Set path to working directory
|
|
||||||
void setcwd(const char* cwd);
|
|
||||||
|
|
||||||
// Delete empty folder (returns "true" if successful)
|
|
||||||
bool rmdir(const char* dir);
|
|
||||||
|
|
||||||
// Delete a file (returns "true" if successful)
|
|
||||||
bool rmfile(const char* name);
|
|
||||||
|
|
||||||
// Create a foldery (returns "true" if successful)
|
|
||||||
bool mkdir(const char* dir);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,14 +0,0 @@
|
|||||||
#ifndef _DLFCN_H
|
|
||||||
#define _DLFCN_H
|
|
||||||
|
|
||||||
#define RTLD_LAZY 0x00001
|
|
||||||
#define RTLD_NOW 0x00002
|
|
||||||
#define RTLD_GLOBAL 0x00100
|
|
||||||
#define RTLD_LOCAL 0
|
|
||||||
|
|
||||||
int dlclose(void *handle);
|
|
||||||
char *dlerror(void);
|
|
||||||
void *dlopen(const char *name, int mode);
|
|
||||||
void *dlsym(void *restrict handle, const char *restrict name);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,42 +0,0 @@
|
|||||||
#ifndef _ERRNO_H
|
|
||||||
#define _ERRNO_H
|
|
||||||
|
|
||||||
extern int errno;
|
|
||||||
/* errors codes from KOS, but minus */
|
|
||||||
# define E_SUCCESS (0)
|
|
||||||
# define E_UNSUPPORTED (-2)
|
|
||||||
# define E_UNKNOWNFS (-3)
|
|
||||||
# define E_NOTFOUND (-5)
|
|
||||||
# define E_EOF (-6)
|
|
||||||
# define E_INVALIDPTR (-7)
|
|
||||||
# define E_DISKFULL (-8)
|
|
||||||
# define E_FSYSERROR (-9)
|
|
||||||
# define E_ACCESS (-10)
|
|
||||||
# define E_HARDWARE (-11)
|
|
||||||
# define E_NOMEM (-12)
|
|
||||||
/* conversion errors */
|
|
||||||
# define ERANGE (-20)
|
|
||||||
# define EINVAL (-21)
|
|
||||||
/* program run and pipe errors */
|
|
||||||
# define E_NOMEM2 (-30)
|
|
||||||
# define E_FILEFMT (-31)
|
|
||||||
# define E_TOOMANY (-32)
|
|
||||||
# define E_PARAM (-33)
|
|
||||||
/* socket error codes*/
|
|
||||||
#define ENOBUFS 1
|
|
||||||
#define EINPROGRESS 2
|
|
||||||
#define EOPNOTSUPP 4
|
|
||||||
#define EWOULDBLOCK 6
|
|
||||||
#define ENOTCONN 9
|
|
||||||
#define EALREADY 10
|
|
||||||
#define EINVALUE 11
|
|
||||||
#define EMSGSIZE 12
|
|
||||||
#define ENOMEM 18
|
|
||||||
#define EADDRINUSE 20
|
|
||||||
#define ECONNREFUSED 61
|
|
||||||
#define ECONNRESET 52
|
|
||||||
#define EISCONN 56
|
|
||||||
#define ETIMEDOUT 60
|
|
||||||
#define ECONNABORTED 53
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,65 +0,0 @@
|
|||||||
#ifndef _FLOAT_H_
|
|
||||||
#define _FLOAT_H_
|
|
||||||
|
|
||||||
#define FLT_RADIX 2
|
|
||||||
|
|
||||||
/* IEEE float */
|
|
||||||
#define FLT_MANT_DIG 24
|
|
||||||
#define FLT_DIG 6
|
|
||||||
#define FLT_ROUNDS 1
|
|
||||||
#define FLT_EPSILON 1.19209290e-07F
|
|
||||||
#define FLT_MIN_EXP (-125)
|
|
||||||
#define FLT_MIN 1.17549435e-38F
|
|
||||||
#define FLT_MIN_10_EXP (-37)
|
|
||||||
#define FLT_MAX_EXP 128
|
|
||||||
#define FLT_MAX 3.40282347e+38F
|
|
||||||
#define FLT_MAX_10_EXP 38
|
|
||||||
|
|
||||||
/* IEEE double */
|
|
||||||
#define DBL_MANT_DIG 53
|
|
||||||
#define DBL_DIG 15
|
|
||||||
#define DBL_EPSILON 2.2204460492503131e-16
|
|
||||||
#define DBL_MIN_EXP (-1021)
|
|
||||||
#define DBL_MIN 2.2250738585072014e-308
|
|
||||||
#define DBL_MIN_10_EXP (-307)
|
|
||||||
#define DBL_MAX_EXP 1024
|
|
||||||
#define DBL_MAX 1.7976931348623157e+308
|
|
||||||
#define DBL_MAX_10_EXP 308
|
|
||||||
|
|
||||||
/* horrible intel long double */
|
|
||||||
#if defined __i386__ || defined __x86_64__
|
|
||||||
|
|
||||||
#define LDBL_MANT_DIG 64
|
|
||||||
#define LDBL_DIG 18
|
|
||||||
#define LDBL_EPSILON 1.08420217248550443401e-19L
|
|
||||||
#define LDBL_MIN_EXP (-16381)
|
|
||||||
#define LDBL_MIN 3.36210314311209350626e-4932L
|
|
||||||
#define LDBL_MIN_10_EXP (-4931)
|
|
||||||
#define LDBL_MAX_EXP 16384
|
|
||||||
#define LDBL_MAX 1.18973149535723176502e+4932L
|
|
||||||
#define LDBL_MAX_10_EXP 4932
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* same as IEEE double */
|
|
||||||
#define LDBL_MANT_DIG 53
|
|
||||||
#define LDBL_DIG 15
|
|
||||||
#define LDBL_EPSILON 2.2204460492503131e-16
|
|
||||||
#define LDBL_MIN_EXP (-1021)
|
|
||||||
#define LDBL_MIN 2.2250738585072014e-308
|
|
||||||
#define LDBL_MIN_10_EXP (-307)
|
|
||||||
#define LDBL_MAX_EXP 1024
|
|
||||||
#define LDBL_MAX 1.7976931348623157e+308
|
|
||||||
#define LDBL_MAX_10_EXP 308
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NAN
|
|
||||||
# define NAN (__nan__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INFINITY
|
|
||||||
# define INFINITY (__inf__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _FLOAT_H_ */
|
|
@ -1,9 +0,0 @@
|
|||||||
#ifndef GETOPT_H
|
|
||||||
#define GETOPT_H
|
|
||||||
|
|
||||||
extern int optind, opterr;
|
|
||||||
extern char *optarg;
|
|
||||||
|
|
||||||
int getopt(int argc, char *argv[], char *optstring);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,197 +0,0 @@
|
|||||||
#ifndef kolibrisys_h
|
|
||||||
#define kolibrisys_h
|
|
||||||
/*
|
|
||||||
#ifdef GNUC
|
|
||||||
#define stdcall __stdcall
|
|
||||||
#define cdecl __cdecl
|
|
||||||
#else
|
|
||||||
#define stdcall ((__stdcall))
|
|
||||||
#define cdecl ((__cdecl))
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
//#ifdef GNUC
|
|
||||||
//#define stdcall __stdcall
|
|
||||||
//#else
|
|
||||||
#define cdecl __attribute__ ((cdecl))
|
|
||||||
#define stdcall __attribute__ ((stdcall))
|
|
||||||
//#endif
|
|
||||||
typedef void* func_ptr;
|
|
||||||
typedef unsigned int dword;
|
|
||||||
typedef unsigned char byte;
|
|
||||||
typedef unsigned short word;
|
|
||||||
|
|
||||||
typedef unsigned int fpos_t;
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
#pragma pack(push,1)
|
|
||||||
struct process_table_entry{
|
|
||||||
int cpu_usage; //+0
|
|
||||||
int window_pos_info; //+4
|
|
||||||
short int reserved1; //+8
|
|
||||||
char name[12]; //+10
|
|
||||||
int memstart; //+22
|
|
||||||
int memused; //+26
|
|
||||||
int pid; //+30
|
|
||||||
int winx_start; //+34
|
|
||||||
int winy_start; //+38
|
|
||||||
int winx_size; //+42
|
|
||||||
int winy_size; //+46
|
|
||||||
short int slot_info; //+50
|
|
||||||
short int reserved2; //+52
|
|
||||||
int clientx; //+54
|
|
||||||
int clienty; //+58
|
|
||||||
int clientwidth; //+62
|
|
||||||
int clientheight; //+66
|
|
||||||
unsigned char window_state;//+70
|
|
||||||
char reserved3[1024-71]; //+71
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
//------------------------KolibriOS system acces to files----------------------------
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
extern dword stdcall _ksys_get_filesize(char *filename);
|
|
||||||
extern dword stdcall _ksys_readfile(char *filename,dword pos,dword blocksize,void *data, int *preadbytes);
|
|
||||||
extern dword stdcall _ksys_rewritefile(char *filename,dword blocksize,void *data);
|
|
||||||
extern dword stdcall _ksys_appendtofile(char *filename,dword pos,dword blocksize,void *data);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//----------------------Run program---------------------------------------------------
|
|
||||||
extern void stdcall _ksys_run_program(char* filename,char* parameters);
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------Debug output---------------------------------------------------
|
|
||||||
extern void stdcall _ksys_debug_out(int c);
|
|
||||||
extern void stdcall debug_out_str(char* str);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------Mouse state----------------------------------------------
|
|
||||||
extern int stdcall _ksys_GetMouseXY(void);
|
|
||||||
extern int stdcall _ksys_GetMouseButtonsState(void);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------get skin height------------------------------------------
|
|
||||||
extern int stdcall _ksys_get_skin_height(void);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//----------------------------background---------------------------------------------
|
|
||||||
extern void stdcall _ksys_set_background_size(int xsize,int ysize);
|
|
||||||
extern void stdcall _ksys_write_background_mem(int pos,int color);
|
|
||||||
extern void stdcall _ksys_draw_background(void);
|
|
||||||
extern void stdcall _ksys_set_background_draw_type(int type);
|
|
||||||
extern void stdcall _ksys_background_blockmove(void* src,int bgr_pos, int count);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//----------------------------functionf for draw window,lines.bar,etc.---------------
|
|
||||||
extern void stdcall _ksys_draw_window(int xcoord,int ycoord, int xsize,
|
|
||||||
int ysize,int workcolor,int type,
|
|
||||||
int captioncolor,int windowtype,int bordercolor);
|
|
||||||
extern void stdcall _ksys_window_redraw(int status);
|
|
||||||
extern int stdcall _ksys_putpixel(int x,int y,int color);
|
|
||||||
extern void stdcall _ksys_draw_bar(int x, int y, int xsize, int ysize, int color);
|
|
||||||
extern void stdcall _ksys_line(int x1,int y1,int x2,int y2,int color);
|
|
||||||
extern void stdcall _ksys_putimage(int x, int y, int xsize, int ysize, void* image);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------write text(system fonts 6x9)-----------------------------
|
|
||||||
extern void stdcall _ksys_write_text(int x,int y,int color,char* text,int len);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------ get screen size and bytes per pixel---------------------------
|
|
||||||
extern int stdcall _ksys_get_screen_size(int* x,int* y);
|
|
||||||
extern void stdcall _ksys_dga_get_resolution(int* xres, int* yres, int* bpp, int* bpscan);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-------------------------------craete thread---------------------------------------
|
|
||||||
extern void* stdcall _ksys_start_thread(void (* func_ptr)(void),int stack_size,int* pid);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------system button(Old function. Better use libGUI functions.)--------
|
|
||||||
extern void stdcall _ksys_make_button(int x, int y, int xsize, int ysize, int id, int color);
|
|
||||||
extern int stdcall _ksys_get_button_id(void); //get state of system button
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//----------------------system clock(in 1/100 sec.) and date--------------------------
|
|
||||||
extern int stdcall _ksys_get_system_clock(void);
|
|
||||||
extern int stdcall _ksys_get_date(void);
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-------------------------system delay(in 1/100 sec.)-------------------------------
|
|
||||||
extern void stdcall _ksys_delay(int m);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------------system events----------------------------------------------
|
|
||||||
extern int stdcall _ksys_wait_for_event_infinite(void);
|
|
||||||
extern int stdcall _ksys_check_for_event(void);
|
|
||||||
extern int stdcall _ksys_wait_for_event(int time);
|
|
||||||
extern void stdcall _ksys_set_wanted_events(int ev);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//----------------------------system exit program------------------------------------
|
|
||||||
extern void stdcall _ksys_exit(void);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------------------system IPC send message-------------------------------
|
|
||||||
extern void stdcall _ksys_send_message(int pid, void* msg, int size);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//---------------------------system work with IRQ from user mode---------------------
|
|
||||||
extern void stdcall _ksys_define_receive_area(void* area, int size);
|
|
||||||
extern int stdcall _ksys_get_irq_owner(int irq);
|
|
||||||
extern int stdcall _ksys_get_data_read_by_irq(int irq, int* size, void* data);
|
|
||||||
extern int stdcall _ksys_send_data_to_device(int port, unsigned char val);
|
|
||||||
extern int stdcall _ksys_receive_data_from_device(int port,unsigned char* data);
|
|
||||||
extern void stdcall _ksys_program_irq(void* intrtable, int irq);
|
|
||||||
extern void stdcall _ksys_reserve_irq(int irq);
|
|
||||||
extern void stdcall _ksys_free_irq(int irq);
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//----------------------------system reserve diapason of ports----------------------
|
|
||||||
extern int stdcall _ksys_reserve_port_area(int start,int end);
|
|
||||||
extern int stdcall _ksys_free_port_area(int start,int end);
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-------------functions get key and set keyboard mode------------------------------
|
|
||||||
extern int stdcall _ksys_get_key(void);
|
|
||||||
extern void stdcall _ksys_set_keyboard_mode(int mode);
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------simple work with MPU401 sound device---------------------------------
|
|
||||||
extern void stdcall _ksys_midi_reset(void);
|
|
||||||
extern void stdcall _ksys_midi_send(int data);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//--------------------------acces to PCI BUS from user mode---------------------------
|
|
||||||
extern int stdcall _ksys_get_pci_version(void);
|
|
||||||
extern int stdcall _ksys_get_last_pci_bus(void);
|
|
||||||
extern int stdcall _ksys_get_pci_access_mechanism(void);
|
|
||||||
extern int stdcall _ksys_pci_read_config_byte(int bus,int dev,int fn,int reg);
|
|
||||||
extern int stdcall _ksys_pci_read_config_word(int bus,int dev,int fn,int reg);
|
|
||||||
extern int stdcall _ksys_pci_read_config_dword(int bus,int dev,int fn,int reg);
|
|
||||||
extern int stdcall _ksys_pci_write_config_byte(int bus,int dev,int fn,int reg,int value);
|
|
||||||
extern int stdcall _ksys_pci_write_config_word(int bus,int dev,int fn,int reg,int value);
|
|
||||||
extern int stdcall _ksys_pci_write_config_dword(int bus,int dev,int fn,int reg,int value);
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------------Working with processes--------------------------------------
|
|
||||||
extern int stdcall _ksys_get_process_table(struct process_table_entry *proctab,int pid); //if pid=-1 than get info about him.
|
|
||||||
extern int stdcall _ksys_kill_process(int pid); // if it returns -1 then an error.
|
|
||||||
//---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//-----------------Old functions for work with sound(Sound Blaster only).---------
|
|
||||||
extern void stdcall _ksys_sound_load_block(void* blockptr);
|
|
||||||
extern void stdcall _ksys_sound_play_block(void);
|
|
||||||
extern void stdcall _ksys_sound_set_channels(int channels);
|
|
||||||
extern void stdcall _ksys_sound_set_data_size(int size);
|
|
||||||
extern void stdcall _ksys_sound_set_frequency(int frequency);
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------------------system speaker(integrated speaker)----------------
|
|
||||||
extern void stdcall _ksys_sound_speaker_play(void* data);
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//------------------function for work with Dinamic Link Librarys(DLL)--------------
|
|
||||||
extern dword* stdcall _ksys_cofflib_load(char* name);
|
|
||||||
extern func_ptr stdcall _ksys_cofflib_getproc(void* exp,char* sz_name);
|
|
||||||
//---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,815 +0,0 @@
|
|||||||
#ifndef __KOS_32_SYS_H__
|
|
||||||
#define __KOS_32_SYS_H__
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef int int32_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef unsigned short int uint16_t;
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TYPE_3_BORDER_WIDTH 5
|
|
||||||
#define WIN_STATE_MINIMIZED 0x02
|
|
||||||
#define WIN_STATE_ROLLED 0x04
|
|
||||||
#define POS_SCREEN 0
|
|
||||||
#define POS_WINDOW 1
|
|
||||||
|
|
||||||
#define IPC_NOBUFFER 1
|
|
||||||
#define IPC_LOCKED 2
|
|
||||||
#define IPC_OVERFLOW 3
|
|
||||||
#define IPC_NOPID 4
|
|
||||||
|
|
||||||
#define SHM_OPEN 0x00
|
|
||||||
#define SHM_OPEN_ALWAYS 0x04
|
|
||||||
#define SHM_CREATE 0x08
|
|
||||||
#define SHM_READ 0x00
|
|
||||||
#define SHM_WRITE 0x01
|
|
||||||
|
|
||||||
// for clipboard funtions
|
|
||||||
#define CLIP_UTF 0
|
|
||||||
#define CLIP_CP866 1
|
|
||||||
#define CLIP_CP1251 2
|
|
||||||
#define CLIP_TEXT 0
|
|
||||||
#define CLIP_IMAGE 1
|
|
||||||
#define CLIP_RAW 2
|
|
||||||
|
|
||||||
//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;
|
|
||||||
uint8_t red;
|
|
||||||
}RGB;
|
|
||||||
|
|
||||||
typedef unsigned int color_t;
|
|
||||||
|
|
||||||
typedef union __attribute__((packed)) pos_t
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
short x;
|
|
||||||
short y;
|
|
||||||
};
|
|
||||||
} pos_t;
|
|
||||||
|
|
||||||
|
|
||||||
typedef union __attribute__((packed)) oskey_t
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
uint8_t state;
|
|
||||||
uint8_t code;
|
|
||||||
uint16_t ctrl_key;
|
|
||||||
};
|
|
||||||
} oskey_t;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned handle;
|
|
||||||
unsigned io_code;
|
|
||||||
void *input;
|
|
||||||
int inp_size;
|
|
||||||
void *output;
|
|
||||||
int out_size;
|
|
||||||
}ioctl_t;
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
void *data;
|
|
||||||
size_t size;
|
|
||||||
} x;
|
|
||||||
unsigned long long raw;
|
|
||||||
}ufile_t;
|
|
||||||
|
|
||||||
struct kolibri_system_colors {
|
|
||||||
color_t frame_area;
|
|
||||||
color_t grab_bar;
|
|
||||||
color_t grab_bar_button;
|
|
||||||
color_t grab_button_text;
|
|
||||||
color_t grab_text;
|
|
||||||
color_t work_area;
|
|
||||||
color_t work_button;
|
|
||||||
color_t work_button_text;
|
|
||||||
color_t work_text;
|
|
||||||
color_t work_graph;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct blit_call
|
|
||||||
{
|
|
||||||
int dstx;
|
|
||||||
int dsty;
|
|
||||||
int w;
|
|
||||||
int h;
|
|
||||||
|
|
||||||
int srcx;
|
|
||||||
int srcy;
|
|
||||||
int srcw;
|
|
||||||
int srch;
|
|
||||||
|
|
||||||
void *bitmap;
|
|
||||||
int stride;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ipc_message
|
|
||||||
{
|
|
||||||
uint32_t pid; // PID of sending thread
|
|
||||||
uint32_t datalen; // data bytes
|
|
||||||
char data[0]; // data begin
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ipc_buffer
|
|
||||||
{
|
|
||||||
uint32_t lock; // nonzero is locked
|
|
||||||
uint32_t used; // used bytes in buffer
|
|
||||||
struct ipc_message data[0]; // data begin
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline void begin_draw(void)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40" ::"a"(12),"b"(1));
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void end_draw(void)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40" ::"a"(12),"b"(2));
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void sys_create_window(int x, int y, int w, int h, const char *name,
|
|
||||||
color_t workcolor, uint32_t style)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(0),
|
|
||||||
"b"((x << 16) | ((w-1) & 0xFFFF)),
|
|
||||||
"c"((y << 16) | ((h-1) & 0xFFFF)),
|
|
||||||
"d"((style << 24) | (workcolor & 0xFFFFFF)),
|
|
||||||
"D"(name),
|
|
||||||
"S"(0) : "memory");
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void sys_change_window(int new_x, int new_y, int new_w, int new_h)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w),"S"(new_h)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void define_button(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(8),
|
|
||||||
"b"(x_w),
|
|
||||||
"c"(y_h),
|
|
||||||
"d"(id),
|
|
||||||
"S"(color));
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void draw_line(int xs, int ys, int xe, int ye, color_t color)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(38), "d"(color),
|
|
||||||
"b"((xs << 16) | xe),
|
|
||||||
"c"((ys << 16) | ye));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void draw_bar(int x, int y, int w, int h, color_t color)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(13), "d"(color),
|
|
||||||
"b"((x << 16) | w),
|
|
||||||
"c"((y << 16) | h));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void draw_bitmap(void *bitmap, int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(7), "b"(bitmap),
|
|
||||||
"c"((w << 16) | h),
|
|
||||||
"d"((x << 16) | y));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void draw_text_sys(const char *text, int x, int y, int len, color_t color)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(4),"d"(text),
|
|
||||||
"b"((x << 16) | y),
|
|
||||||
"S"(len),"c"(color)
|
|
||||||
:"memory");
|
|
||||||
}
|
|
||||||
static inline
|
|
||||||
void draw_text_sys_bg(const char *text, int x, int y, int len, color_t color, color_t bg)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(4),"d"(text),
|
|
||||||
"b"((x << 16) | y),
|
|
||||||
"S"(len),"c"(color), "D"(bg)
|
|
||||||
:"memory");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t get_skin_height(void)
|
|
||||||
{
|
|
||||||
uint32_t height;
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40 \n\t"
|
|
||||||
:"=a"(height)
|
|
||||||
:"a"(48),"b"(4));
|
|
||||||
return height;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
pos_t get_mouse_pos(int origin)
|
|
||||||
{
|
|
||||||
pos_t val;
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40 \n\t"
|
|
||||||
"rol $16, %%eax"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(37),"b"(origin));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t get_mouse_buttons(void)
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(37),"b"(2));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t get_mouse_wheels(void)
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40 \n\t"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(37),"b"(7));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline uint32_t load_cursor(void *path, uint32_t flags)
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(37), "b"(4), "c"(path), "d"(flags));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t set_cursor(uint32_t cursor)
|
|
||||||
{
|
|
||||||
uint32_t old;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(old)
|
|
||||||
:"a"(37), "b"(5), "c"(cursor));
|
|
||||||
return old;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline int destroy_cursor(uint32_t cursor)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(ret)
|
|
||||||
:"a"(37), "b"(6), "c"(cursor)
|
|
||||||
:"memory");
|
|
||||||
return ret;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t wait_for_event(uint32_t time)
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(23), "b"(time));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline uint32_t check_os_event()
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(11));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline uint32_t get_os_event()
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(10));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t get_tick_count(void)
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(26),"b"(9));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint64_t get_ns_count(void)
|
|
||||||
{
|
|
||||||
uint64_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=A"(val)
|
|
||||||
:"a"(26), "b"(10));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline oskey_t get_key(void)
|
|
||||||
{
|
|
||||||
oskey_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(2));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t get_os_button()
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(17));
|
|
||||||
return val>>8;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline uint32_t get_service(char *name)
|
|
||||||
{
|
|
||||||
uint32_t retval = 0;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(retval)
|
|
||||||
:"a"(68),"b"(16),"c"(name)
|
|
||||||
:"memory");
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline int call_service(ioctl_t *io)
|
|
||||||
{
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(retval)
|
|
||||||
:"a"(68),"b"(17),"c"(io)
|
|
||||||
:"memory","cc");
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static inline void yield(void)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(68), "b"(1));
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline void delay(uint32_t time)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
::"a"(5), "b"(time)
|
|
||||||
:"memory");
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void *user_alloc(size_t size)
|
|
||||||
{
|
|
||||||
void *val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(68),"b"(12),"c"(size));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int user_free(void *mem)
|
|
||||||
{
|
|
||||||
int val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(68),"b"(13),"c"(mem));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void* user_realloc(void *mem, size_t size)
|
|
||||||
{
|
|
||||||
void *val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(68),"b"(20),"c"(size),"d"(mem)
|
|
||||||
:"memory");
|
|
||||||
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int *user_unmap(void *base, size_t offset, size_t size)
|
|
||||||
{
|
|
||||||
int *val;
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline ufile_t load_file(const char *path)
|
|
||||||
{
|
|
||||||
ufile_t uf;
|
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"int $0x40"
|
|
||||||
:"=A"(uf.raw)
|
|
||||||
:"a" (68), "b"(27),"c"(path));
|
|
||||||
|
|
||||||
return uf;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline int GetScreenSize()
|
|
||||||
{
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(retval)
|
|
||||||
:"a"(61), "b"(1));
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void get_proc_info(char *info)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:
|
|
||||||
:"a"(9), "b"(info), "c"(-1)
|
|
||||||
:"memory");
|
|
||||||
};
|
|
||||||
|
|
||||||
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));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// newlib exclusive
|
|
||||||
#ifndef __TINYC__
|
|
||||||
int create_thread(int (*proc)(void *param), void *param, int stack_size);
|
|
||||||
|
|
||||||
void* load_library(const char *name);
|
|
||||||
|
|
||||||
void* get_proc_address(void *handle, const char *proc_name);
|
|
||||||
|
|
||||||
void enumerate_libraries(int (*callback)(void *handle, const char* name,
|
|
||||||
uint32_t base, uint32_t size, void *user_data),
|
|
||||||
void *user_data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// May be next section need to be added in newlibc
|
|
||||||
|
|
||||||
enum KOLIBRI_GUI_EVENTS {
|
|
||||||
KOLIBRI_EVENT_NONE = 0, /* Event queue is empty */
|
|
||||||
KOLIBRI_EVENT_REDRAW = 1, /* Window and window elements should be redrawn */
|
|
||||||
KOLIBRI_EVENT_KEY = 2, /* A key on the keyboard was pressed */
|
|
||||||
KOLIBRI_EVENT_BUTTON = 3, /* A button was clicked with the mouse */
|
|
||||||
KOLIBRI_EVENT_DESKTOP = 5, /* Desktop redraw finished */
|
|
||||||
KOLIBRI_EVENT_MOUSE = 6, /* Mouse activity (movement, button press) was detected */
|
|
||||||
KOLIBRI_EVENT_IPC = 7, /* Interprocess communication notify */
|
|
||||||
KOLIBRI_EVENT_NETWORK = 8, /* Network event */
|
|
||||||
KOLIBRI_EVENT_DEBUG = 9, /* Debug subsystem event */
|
|
||||||
KOLIBRI_EVENT_IRQBEGIN = 16 /* 16..31 IRQ0..IRQ15 interrupt =IRQBEGIN+IRQn */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// copied from /programs/system/shell/system/kolibri.c
|
|
||||||
// fn's returned -1 as syserror, 1 as error, 0 as OK
|
|
||||||
static inline
|
|
||||||
int kol_clip_num()
|
|
||||||
{
|
|
||||||
register uint32_t val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(0));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
char* kol_clip_get(int n)
|
|
||||||
// returned buffer must be freed by user_free()
|
|
||||||
{
|
|
||||||
register char* val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(1), "c"(n));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int kol_clip_set(int n, char buffer[])
|
|
||||||
{
|
|
||||||
register uint32_t val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(2), "c"(n), "d"(buffer));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int kol_clip_pop()
|
|
||||||
{
|
|
||||||
register uint32_t val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(3));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int kol_clip_unlock()
|
|
||||||
{
|
|
||||||
register uint32_t val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(4));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void get_system_colors(struct kolibri_system_colors *color_table)
|
|
||||||
{
|
|
||||||
__asm__ volatile ("int $0x40"
|
|
||||||
:
|
|
||||||
:"a"(48),"b"(3),"c"(color_table),"d"(40)
|
|
||||||
);
|
|
||||||
|
|
||||||
/* color_table should point to the system color table */
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void debug_board_write_byte(const char ch){
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:
|
|
||||||
:"a"(63), "b"(1), "c"(ch));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void draw_number_sys(int32_t number, int x, int y, int len, color_t color){
|
|
||||||
register uint32_t fmt;
|
|
||||||
fmt = len << 16 | 0x80000000; // no leading zeros + width
|
|
||||||
// fmt = len << 16 | 0x00000000; // leading zeros + width
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:
|
|
||||||
:"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void draw_number_sys_bg(int32_t number, int x, int y, int len, color_t color, color_t bg){
|
|
||||||
register uint32_t fmt;
|
|
||||||
fmt = len << 16 | 0x80000000; // no leading zeros + width
|
|
||||||
// fmt = len << 16 | 0x00000000; // leading zeros + width
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:
|
|
||||||
:"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color), "D"(bg));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t get_mouse_eventstate(void)
|
|
||||||
{
|
|
||||||
uint32_t val;
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
|
||||||
"int $0x40"
|
|
||||||
:"=a"(val)
|
|
||||||
:"a"(37),"b"(3));
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
|
||||||
uint32_t set_event_mask(uint32_t mask)
|
|
||||||
{
|
|
||||||
register uint32_t val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(40), "b"(mask));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef void (*thread_proc)(void*);
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int start_thread(thread_proc proc, char* stack_top)
|
|
||||||
{
|
|
||||||
register int val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(51), "b"(1), "c"(proc), "d"(stack_top));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void kos_exit()
|
|
||||||
{
|
|
||||||
asm volatile ("int $0x40"::"a"(-1));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void focus_window(int slot){
|
|
||||||
asm volatile ("int $0x40"::"a"(18), "b"(3), "c"(slot));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int get_thread_slot(int tid){
|
|
||||||
register int val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(18), "b"(21), "c"(tid));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void set_current_folder(char* dir){
|
|
||||||
asm volatile ("int $0x40"::"a"(30), "b"(1), "c"(dir));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int get_current_folder(char* buf, int bufsize){
|
|
||||||
register int val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(30), "b"(2), "c"(buf), "d"(bufsize));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void ipc_set_area(void* buf, int bufsize){
|
|
||||||
asm volatile ("int $0x40"::"a"(60), "b"(1), "c"(buf), "d"(bufsize));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int ipc_send_message(int pid_reciever, void *data, int datalen) {
|
|
||||||
register int val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(60), "b"(2), "c"(pid_reciever), "d"(data), "S"(datalen));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void* shm_open(char *shm_name, int msize, int flags, int *retsz){
|
|
||||||
register int val, cod;
|
|
||||||
asm volatile ("int $0x40":"=a"(val),"=d"(cod):"a"(68), "b"(22), "c"(shm_name), "d"(msize), "S"(flags));
|
|
||||||
|
|
||||||
if(retsz) *retsz = cod; // errcode if NULL or memsize when open
|
|
||||||
return (void*)val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void shm_close(char *shm_name){
|
|
||||||
asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(shm_name));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
int start_app(char *app_name, char *args){
|
|
||||||
struct file_op_t
|
|
||||||
{
|
|
||||||
uint32_t fn;
|
|
||||||
uint32_t flags;
|
|
||||||
char* args;
|
|
||||||
uint32_t res1, res2;
|
|
||||||
char zero;
|
|
||||||
char* app_name __attribute__((packed));
|
|
||||||
} file_op;
|
|
||||||
memset(&file_op, 0, sizeof(file_op));
|
|
||||||
file_op.fn = 7;
|
|
||||||
file_op.args = args;
|
|
||||||
file_op.app_name = app_name;
|
|
||||||
|
|
||||||
register int val;
|
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(70), "b"(&file_op));
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TinyC don't support aliasing of static inline funcs, but support #define :)
|
|
||||||
#ifndef __TINYC__
|
|
||||||
static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw")));
|
|
||||||
static inline void EndDraw(void) __attribute__ ((alias ("end_draw")));
|
|
||||||
static inline void DrawWindow(int x, int y, int w, int h, const char *name,
|
|
||||||
color_t workcolor, uint32_t style)
|
|
||||||
__attribute__ ((alias ("sys_create_window")));
|
|
||||||
static inline void DefineButton(void) __attribute__ ((alias ("define_button")));
|
|
||||||
static inline void DrawLine(int xs, int ys, int xe, int ye, color_t color)
|
|
||||||
__attribute__ ((alias ("draw_line")));
|
|
||||||
static inline void DrawBar(int x, int y, int w, int h, color_t color)
|
|
||||||
__attribute__ ((alias ("draw_bar")));
|
|
||||||
static inline void DrawBitmap(void *bitmap, int x, int y, int w, int h)
|
|
||||||
__attribute__ ((alias ("draw_bitmap")));
|
|
||||||
static inline uint32_t GetSkinHeight(void) __attribute__ ((alias ("get_skin_height")));
|
|
||||||
static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos")));
|
|
||||||
static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons")));
|
|
||||||
static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels")));
|
|
||||||
static inline uint32_t LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor")));
|
|
||||||
static inline uint32_t SetCursor(uint32_t cursor) __attribute__ ((alias ("set_cursor")));
|
|
||||||
static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor")));
|
|
||||||
static inline uint32_t GetOsEvent(void) __attribute__ ((alias ("get_os_event")));
|
|
||||||
static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc")));
|
|
||||||
static inline int UserFree(void *mem) __attribute__ ((alias ("user_free")));
|
|
||||||
static inline void* UserRealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc")));
|
|
||||||
static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap")));
|
|
||||||
static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file")));
|
|
||||||
static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info")));
|
|
||||||
#else
|
|
||||||
#define BeginDraw begin_draw
|
|
||||||
#define EndDraw end_draw
|
|
||||||
#define DrawWindow sys_create_window
|
|
||||||
#define DefineButton define_button
|
|
||||||
#define DrawLine draw_line
|
|
||||||
#define DrawBar draw_bar
|
|
||||||
#define DrawBitmap draw_bitmap
|
|
||||||
#define GetSkinHeight get_skin_height
|
|
||||||
#define GetMousePos get_mouse_pos
|
|
||||||
#define GetMouseButtons get_mouse_buttons
|
|
||||||
#define GetMouseWheels get_mouse_wheels
|
|
||||||
#define LoadCursor load_cursor
|
|
||||||
#define SetCursor set_cursor
|
|
||||||
#define DestroyCursor destroy_cursor
|
|
||||||
#define GetOsEvent get_os_event
|
|
||||||
#define UserAlloc user_alloc
|
|
||||||
#define UserFree user_free
|
|
||||||
#define UserRealloc user_realloc
|
|
||||||
#define UserUnmap user_unmap
|
|
||||||
#define LoadFile load_file
|
|
||||||
#define GetProcInfo get_proc_info
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
#ifndef __KTCC_LIBGEN_H__
|
|
||||||
#define __KTCC_LIBGEN_H__
|
|
||||||
|
|
||||||
char *basename(char *path);
|
|
||||||
char *dirname(char *path);
|
|
||||||
|
|
||||||
#endif // __KTCC_LIBGEN_H__
|
|
@ -1,55 +0,0 @@
|
|||||||
/* Copyright (C) 1999 DJ Delorie, see http://www.delorie.com/copyright.html for details */
|
|
||||||
/* Copyright (C) 1998 DJ Delorie, see http://www.delorie.com/copyright.html for details */
|
|
||||||
/* Copyright (C) 1995 DJ Delorie, see http://www.delorie.com/copyright.html for details */
|
|
||||||
|
|
||||||
#ifndef _MATH_H
|
|
||||||
#define _MATH_H
|
|
||||||
|
|
||||||
extern double acos(double _x);
|
|
||||||
extern double asin(double _x);
|
|
||||||
extern double atan(double _x);
|
|
||||||
extern double atan2(double _y, double _x);
|
|
||||||
extern float ceilf(float);
|
|
||||||
extern double ceil(double _x);
|
|
||||||
extern double cos(double _x);
|
|
||||||
extern double cosh(double _x);
|
|
||||||
extern double exp(double _x);
|
|
||||||
extern double exp2(double _x);
|
|
||||||
extern double fabs(double _x);
|
|
||||||
extern float fabsf(float);
|
|
||||||
extern double floor(double _x);
|
|
||||||
extern float floorf(float);
|
|
||||||
extern double fmod(double _x, double _y);
|
|
||||||
extern double frexp(double _x, int *_pexp);
|
|
||||||
extern double ldexp(double _x, int _exp);
|
|
||||||
extern double remainder(double, double);
|
|
||||||
extern double log(double _y);
|
|
||||||
extern double log10(double _x);
|
|
||||||
extern double modf(double _x, double *_pint);
|
|
||||||
extern double pow(double _x, double _y);
|
|
||||||
extern double sin(double _x);
|
|
||||||
extern double sinh(double _x);
|
|
||||||
extern double sqrt(double _x);
|
|
||||||
extern float sqrtf(float);
|
|
||||||
extern double tan(double _x);
|
|
||||||
extern double tanh(double _x);
|
|
||||||
extern double round(double x);
|
|
||||||
extern long double roundl (long double x);
|
|
||||||
|
|
||||||
#define M_E 2.7182818284590452354
|
|
||||||
#define M_LOG2E 1.4426950408889634074
|
|
||||||
#define M_LOG10E 0.43429448190325182765
|
|
||||||
#define M_LN2 0.69314718055994530942
|
|
||||||
#define M_LN10 2.30258509299404568402
|
|
||||||
#define M_PI 3.14159265358979323846
|
|
||||||
#define M_PI_2 1.57079632679489661923
|
|
||||||
#define M_PI_4 0.78539816339744830962
|
|
||||||
#define M_1_PI 0.31830988618379067154
|
|
||||||
#define M_2_PI 0.63661977236758134308
|
|
||||||
#define M_2_SQRTPI 1.12837916709551257390
|
|
||||||
#define M_SQRT2 1.41421356237309504880
|
|
||||||
#define M_SQRT1_2 0.70710678118654752440
|
|
||||||
#define PI M_PI
|
|
||||||
#define PI2 M_PI_2
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef _MEMORY_H
|
|
||||||
#define _MEMORY_H
|
|
||||||
|
|
||||||
#ifndef _STRING_H
|
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
#ifndef __NETWORK_H
|
|
||||||
#define __NETWORK_H
|
|
||||||
|
|
||||||
#include <net/socket.h>
|
|
||||||
|
|
||||||
#define EAI_ADDRFAMILY 1
|
|
||||||
#define EAI_AGAIN 2
|
|
||||||
#define EAI_BADFLAGS 3
|
|
||||||
#define EAI_FAIL 4
|
|
||||||
#define EAI_FAMILY 5
|
|
||||||
#define EAI_MEMORY 6
|
|
||||||
#define EAI_NONAME 8
|
|
||||||
#define EAI_SERVICE 9
|
|
||||||
#define EAI_SOCKTYPE 10
|
|
||||||
#define EAI_BADHINTS 12
|
|
||||||
#define EAI_PROTOCOL 13
|
|
||||||
#define EAI_OVERFLOW 14
|
|
||||||
|
|
||||||
// Flags for addrinfo
|
|
||||||
#define AI_PASSIVE 1
|
|
||||||
#define AI_CANONNAME 2
|
|
||||||
#define AI_NUMERICHOST 4
|
|
||||||
#define AI_NUMERICSERV 8
|
|
||||||
#define AI_ADDRCONFIG 0x400
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
struct ARP_entry{
|
|
||||||
unsigned int IP;
|
|
||||||
unsigned char MAC[6];
|
|
||||||
unsigned short status;
|
|
||||||
unsigned short TTL;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
struct addrinfo {
|
|
||||||
int ai_flags;
|
|
||||||
int ai_family;
|
|
||||||
int ai_socktype;
|
|
||||||
int ai_protocol;
|
|
||||||
int ai_addrlen;
|
|
||||||
char *ai_canonname;
|
|
||||||
struct sockaddr *ai_addr;
|
|
||||||
struct addrinfo *ai_next;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
extern int networklib_init ();
|
|
||||||
extern int (*inet_addr __attribute__ ((stdcall)))(const char* hostname);
|
|
||||||
extern char* (*inet_ntoa __attribute__ ((stdcall)))(int ip_addr);
|
|
||||||
extern int (*getaddrinfo __attribute__ ((stdcall)))(const char* hostname, const char* servname, const struct addrinfo* hints, struct addrinfo** res);
|
|
||||||
extern void (*freeaddrinfo __attribute__ ((stdcall)))(struct addrinfo* ai);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,89 +0,0 @@
|
|||||||
#ifndef __SOCKET_H
|
|
||||||
#define __SOCKET_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
// Socket Types
|
|
||||||
#define SOCK_STREAM 1
|
|
||||||
#define SOCK_DGRAM 2
|
|
||||||
#define SOCK_RAW 3
|
|
||||||
|
|
||||||
// IP protocols
|
|
||||||
#define IPPROTO_IP 0
|
|
||||||
#define IPPROTO_ICMP 1
|
|
||||||
#define IPPROTO_TCP 6
|
|
||||||
#define IPPROTO_UDP 17
|
|
||||||
#define IPPROTO_RAW 255
|
|
||||||
|
|
||||||
// IP options
|
|
||||||
#define IP_TTL 2
|
|
||||||
|
|
||||||
// Address families
|
|
||||||
#define AF_UNSPEC 0
|
|
||||||
#define AF_LOCAL 1
|
|
||||||
#define AF_INET 2
|
|
||||||
#define AF_INET4 2 // IPv4
|
|
||||||
#define AF_INET6 10 // IPv6
|
|
||||||
|
|
||||||
#define PF_UNSPEC AF_UNSPEC
|
|
||||||
#define PF_LOCAL AF_LOCAL
|
|
||||||
#define PF_INET4 AF_INET4
|
|
||||||
#define PF_INET6 AF_INET6
|
|
||||||
|
|
||||||
// internal definition
|
|
||||||
#define AI_SUPPORTED 0x40F
|
|
||||||
|
|
||||||
// for system function 76
|
|
||||||
#define API_ETH (0<<16)
|
|
||||||
#define API_IPv4 (1<<16)
|
|
||||||
#define API_ICMP (2<<16)
|
|
||||||
#define API_UDP (3<<16)
|
|
||||||
#define API_TCP (4<<16)
|
|
||||||
#define API_ARP (5<<16)
|
|
||||||
#define API_PPPOE (6<<16)
|
|
||||||
|
|
||||||
// Socket flags for user calls
|
|
||||||
#define MSG_NOFLAG 0
|
|
||||||
#define MSG_PEEK 0x02
|
|
||||||
#define MSG_DONTWAIT 0x40
|
|
||||||
|
|
||||||
// Socket levels
|
|
||||||
#define SOL_SOCKET 0xffff
|
|
||||||
|
|
||||||
//Socket options
|
|
||||||
#define SO_BINDTODEVICE (1<<9)
|
|
||||||
#define SO_NONBLOCK (1<<31)
|
|
||||||
#define PORT(X) (X<<8)
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
|
||||||
struct sockaddr{
|
|
||||||
unsigned short sin_family;
|
|
||||||
unsigned short sin_port;
|
|
||||||
unsigned int sin_addr;
|
|
||||||
unsigned long long sin_zero;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
|
||||||
typedef struct{
|
|
||||||
unsigned int level;
|
|
||||||
unsigned int optionname;
|
|
||||||
unsigned int optlenght;
|
|
||||||
unsigned char options;
|
|
||||||
}optstruct;
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
int socket(int domain, int type, int protocol);
|
|
||||||
int close(int socket);
|
|
||||||
int bind(int socket, const struct sockaddr *addres, int addres_len);
|
|
||||||
int listen(int socket, int backlog);
|
|
||||||
int connect(int socket, const struct sockaddr* address, int socket_len);
|
|
||||||
int accept(int socket, const struct sockaddr* address, int address_len);
|
|
||||||
int send(int socket, const void *message, size_t msg_len, int flag);
|
|
||||||
int recv(int socket, void *buffer, size_t buff_len, int flag);
|
|
||||||
int setsockopt(int socket,const optstruct* opt);
|
|
||||||
int getsockopt(int socket, optstruct* opt);
|
|
||||||
int socketpair(int *sock1, int *sock2);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,75 +0,0 @@
|
|||||||
#ifndef _STDARG_H
|
|
||||||
#define _STDARG_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];
|
|
||||||
|
|
||||||
void __va_start(__va_list_struct *ap, void *fp);
|
|
||||||
void *__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;
|
|
||||||
#define _VA_LIST_DEFINED
|
|
||||||
|
|
||||||
#endif /* _STDARG_H */
|
|
@ -1,11 +0,0 @@
|
|||||||
#ifndef _STDBOOL_H
|
|
||||||
#define _STDBOOL_H
|
|
||||||
|
|
||||||
/* ISOC99 boolean */
|
|
||||||
|
|
||||||
#define bool _Bool
|
|
||||||
#define true 1
|
|
||||||
#define false 0
|
|
||||||
#define __bool_true_false_are_defined 1
|
|
||||||
|
|
||||||
#endif /* _STDBOOL_H */
|
|
@ -1,46 +0,0 @@
|
|||||||
#ifndef _STDDEF_H
|
|
||||||
#define _STDDEF_H
|
|
||||||
|
|
||||||
typedef __SIZE_TYPE__ size_t;
|
|
||||||
typedef __PTRDIFF_TYPE__ ssize_t;
|
|
||||||
typedef __WCHAR_TYPE__ wchar_t;
|
|
||||||
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;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL ((void*)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define offsetof(type, field) ((size_t)&((type *)0)->field)
|
|
||||||
|
|
||||||
void *alloca(size_t size);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Older glibc require a wint_t from <stddef.h> (when requested
|
|
||||||
by __need_wint_t, as otherwise stddef.h isn't allowed to
|
|
||||||
define this type). Note that this must be outside the normal
|
|
||||||
_STDDEF_H guard, so that it works even when we've included the file
|
|
||||||
already (without requiring wint_t). Some other libs define _WINT_T
|
|
||||||
if they've already provided that type, so we can use that as guard.
|
|
||||||
TCC defines __WINT_TYPE__ for us. */
|
|
||||||
#if defined (__need_wint_t)
|
|
||||||
#ifndef _WINT_T
|
|
||||||
#define _WINT_T
|
|
||||||
typedef __WINT_TYPE__ wint_t;
|
|
||||||
#endif
|
|
||||||
#undef __need_wint_t
|
|
||||||
#endif
|
|
@ -1 +0,0 @@
|
|||||||
#include <stddef.h>
|
|
@ -1,105 +0,0 @@
|
|||||||
#ifndef stdio_h
|
|
||||||
#define stdio_h
|
|
||||||
|
|
||||||
#include "kolibrisys.h"
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
/* use stdarg.h
|
|
||||||
typedef char *va_list;
|
|
||||||
#define _roundsize(n) ( (sizeof(n) + 3) & ~3 )
|
|
||||||
#define va_start(ap,v) (ap = (va_list)&v+_roundsize(v))
|
|
||||||
#define va_arg(ap,t) ( *(t *)((ap += _roundsize(t)) - _roundsize(t)) )
|
|
||||||
#define va_end(ap) (ap = (va_list)0)
|
|
||||||
*/
|
|
||||||
#ifndef NULL
|
|
||||||
# define NULL ((void*)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef unsigned int fpos_t; // 32bit is not enough! 4Gb limit
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
|
|
||||||
int format_print(char *dest, size_t maxlen,const char *fmt0, va_list argp);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char* buffer;
|
|
||||||
dword buffersize;
|
|
||||||
dword filesize; // too small
|
|
||||||
int filepos; // too small, may be -1
|
|
||||||
char* filename;
|
|
||||||
int mode;
|
|
||||||
int ungetc_buf;
|
|
||||||
dword buffer_start; // 1st byte position
|
|
||||||
dword buffer_end; // points after last buffered data
|
|
||||||
} FILE;
|
|
||||||
|
|
||||||
#define stderr ((FILE*)3) /* works only for fprintf!!! */
|
|
||||||
|
|
||||||
#define FILE_OPEN_READ 0
|
|
||||||
#define FILE_OPEN_WRITE 1
|
|
||||||
#define FILE_OPEN_APPEND 2
|
|
||||||
#define FILE_OPEN_TEXT 4
|
|
||||||
#define FILE_OPEN_PLUS 8
|
|
||||||
#define EOF (-1)
|
|
||||||
#define BUFSIZ (4096)
|
|
||||||
#define FILENAME_MAX (0x400)
|
|
||||||
|
|
||||||
extern FILE* fopen(const char* filename, const char *mode);
|
|
||||||
extern int fclose(FILE* file);
|
|
||||||
extern int feof(FILE* file);
|
|
||||||
extern int fflush(FILE* file);
|
|
||||||
extern int fgetc(FILE* file);
|
|
||||||
extern int fgetpos(FILE* file,fpos_t* pos);
|
|
||||||
extern int fsetpos(FILE* file,const fpos_t* pos);
|
|
||||||
extern int fputc(int c,FILE* file);
|
|
||||||
extern int fread(void* buffer,int size,int count,FILE* file);
|
|
||||||
extern int fwrite(void *buffer,int size,int count,FILE* file);
|
|
||||||
extern long ftell(FILE* file);
|
|
||||||
#define SEEK_CUR 0
|
|
||||||
#define SEEK_END 1
|
|
||||||
#define SEEK_SET 2
|
|
||||||
extern int fseek(FILE* file,long offset,int origin);
|
|
||||||
extern void rewind(FILE* file);
|
|
||||||
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 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,...);
|
|
||||||
|
|
||||||
#define getc(a) fgetc(a)
|
|
||||||
#define putc(a, b) fputc(a, b)
|
|
||||||
char * fgets (char * str, int num, FILE * stream);
|
|
||||||
int putchar (int ch);
|
|
||||||
int getchar (void);
|
|
||||||
int puts (const char * str);
|
|
||||||
char * gets (char * str);
|
|
||||||
|
|
||||||
typedef int (*virtual_getc)(void *sp, const void *obj);
|
|
||||||
typedef void (*virtual_ungetc)(void *sp, int c, const void *obj);
|
|
||||||
int format_scan(const void *src, const char *fmt, va_list argp, virtual_getc vgetc, virtual_ungetc vungetc);
|
|
||||||
int vscanf ( const char * format, va_list arg );
|
|
||||||
int scanf ( const char * format, ...);
|
|
||||||
int vsscanf ( const char * s, const char * format, va_list arg );
|
|
||||||
int sscanf ( const char * s, const char * format, ...);
|
|
||||||
int vfscanf ( FILE * stream, const char * format, va_list arg );
|
|
||||||
int fputs ( const char * str, FILE * file );
|
|
||||||
void clearerr ( FILE * stream );
|
|
||||||
int ferror ( FILE * stream );
|
|
||||||
void perror ( const char * str );
|
|
||||||
int vprintf ( const char * format, va_list arg );
|
|
||||||
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, ... );
|
|
||||||
int tiny_vsnprintf (char * s, size_t n, const char * format, va_list args );
|
|
||||||
// support %c, %s, %d, %x, %u, %% for 32-bit values only. no width specs, left align
|
|
||||||
// always zero-ended
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
|||||||
#ifndef stdlib_h
|
|
||||||
#define stdlib_h
|
|
||||||
#include "kolibrisys.h"
|
|
||||||
|
|
||||||
#define RAND_MAX 65535
|
|
||||||
#ifndef NULL
|
|
||||||
# define NULL ((void*)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define abs(i) (((i)<0)?(-(i)):(i))
|
|
||||||
#define labs(li) abs(li)
|
|
||||||
|
|
||||||
#define min(a, b) ((a)<(b) ? (a) : (b))
|
|
||||||
#define max(a, b) ((a)>(b) ? (a) : (b))
|
|
||||||
|
|
||||||
|
|
||||||
extern int atoib(char *s,int b);
|
|
||||||
extern int atoi(char *s);
|
|
||||||
extern char *itoab(unsigned int n,char* s,int b);
|
|
||||||
extern char *__itoa(int n,char* s);
|
|
||||||
|
|
||||||
// function using KOS syscalls
|
|
||||||
extern void* stdcall sysmalloc(dword size);
|
|
||||||
extern void stdcall sysfree(void *pointer);
|
|
||||||
extern void* stdcall sysrealloc(void* pointer,dword size);
|
|
||||||
extern void* syscalloc (size_t num, size_t size);
|
|
||||||
|
|
||||||
// suballocator functions
|
|
||||||
extern void* wtmalloc(size_t size);
|
|
||||||
extern void wtfree(void *pointer);
|
|
||||||
extern void* wtrealloc(void* pointer, size_t size);
|
|
||||||
extern void* wtcalloc (size_t num, size_t size);
|
|
||||||
extern int wtmalloc_freelist_check();
|
|
||||||
extern int wtmalloc_poiner_check(void *ptr);
|
|
||||||
extern void wtmalloc_freelist_print();
|
|
||||||
|
|
||||||
#ifdef USESYSALLOC
|
|
||||||
#define malloc(x) sysmalloc(x)
|
|
||||||
#define free(x) sysfree(x)
|
|
||||||
#define realloc(x,y) sysrealloc(x,y)
|
|
||||||
#define calloc(x,y) syscalloc(x,y)
|
|
||||||
#else
|
|
||||||
#define malloc(x) wtmalloc(x)
|
|
||||||
#define free(x) wtfree(x)
|
|
||||||
#define realloc(x,y) wtrealloc(x,y)
|
|
||||||
#define calloc(x,y) wtcalloc(x,y)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern int rand (void);
|
|
||||||
extern void srand (unsigned int seed);
|
|
||||||
|
|
||||||
double strtod (const char* str, char** endptr);
|
|
||||||
long double strtold (const char* str, char** endptr);
|
|
||||||
float strtof (const char* str, char** endptr);
|
|
||||||
long int strtol (const char* str, char** endptr, int base);
|
|
||||||
#define strtoul(s, ep, b) ((unsigned long int)strtol(s, ep, b))
|
|
||||||
|
|
||||||
|
|
||||||
void exit (int status); /* close console if was initialized, also stay window [finished] when status is error < 0 */
|
|
||||||
#define abort() exit(-1)
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int quot;
|
|
||||||
int rem;
|
|
||||||
} div_t;
|
|
||||||
|
|
||||||
typedef div_t ldiv_t;
|
|
||||||
|
|
||||||
div_t div (int numer, int denom);
|
|
||||||
#define ldiv(a, b) div(a, b)
|
|
||||||
#define atol(a) atoi(a)
|
|
||||||
#define atof(a) strtod(a, NULL)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,36 +0,0 @@
|
|||||||
#ifndef string_h
|
|
||||||
#define string_h
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
|
|
||||||
|
|
||||||
extern void* memchr(const void*,int,size_t);
|
|
||||||
extern void* memrchr(const void*,int,size_t);
|
|
||||||
extern int memcmp(const void*,const void*,size_t);
|
|
||||||
extern void* memcpy(void*,const void*,size_t);
|
|
||||||
extern void* memmove(void*,const void*,size_t);
|
|
||||||
extern void* memset(void*,int,size_t);
|
|
||||||
extern char* strcat(char*,const char*);
|
|
||||||
extern char* strchr(const char*,int);
|
|
||||||
extern int strcmp(const char*,const char*);
|
|
||||||
extern int strcoll(const char*,const char*);
|
|
||||||
extern char* strcpy(char*,const char*);
|
|
||||||
extern size_t strcspn(const char*,const char*);
|
|
||||||
extern int strlen(const char*);
|
|
||||||
extern char* strncat(char*,const char*,size_t);
|
|
||||||
extern int strncmp(const char*,const char*,size_t);
|
|
||||||
extern char* strncpy(char*,const char*,size_t);
|
|
||||||
extern char* strpbrk(const char*,const char*);
|
|
||||||
extern char* strrchr(const char*,int);
|
|
||||||
extern size_t strspn(const char*,const char*);
|
|
||||||
extern char* strstr(const char*,const char*);
|
|
||||||
extern char* strtok(char*,const char*);
|
|
||||||
extern int strxfrm(char*,const char*,int);
|
|
||||||
extern char* strdup(const char*);
|
|
||||||
extern char* strrev(char *p);
|
|
||||||
char * strerror ( int errnum );
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
# define NULL ((void*)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,29 +0,0 @@
|
|||||||
#ifndef _TIME_H
|
|
||||||
#define _TIME_H
|
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned long int clock_t;
|
|
||||||
typedef unsigned long int time_t;
|
|
||||||
#define clock() get_tick_count()
|
|
||||||
#define CLOCKS_PER_SEC 100
|
|
||||||
|
|
||||||
struct tm {
|
|
||||||
int tm_sec; /* seconds after the minute 0-61*/
|
|
||||||
int tm_min; /* minutes after the hour 0-59 */
|
|
||||||
int tm_hour; /* hours since midnight 0-23 */
|
|
||||||
int tm_mday; /* day of the month 1-31 */
|
|
||||||
int tm_mon; /* months since January 0-11 */
|
|
||||||
int tm_year; /* years since 1900 */
|
|
||||||
int tm_wday; /* days since Sunday 0-6 */
|
|
||||||
int tm_yday; /* days since January 1 0-365 */
|
|
||||||
int tm_isdst; /* Daylight Saving Time flag */
|
|
||||||
};
|
|
||||||
|
|
||||||
time_t mktime (struct tm * timeptr);
|
|
||||||
time_t time (time_t* timer);
|
|
||||||
struct tm * localtime (const time_t * timer); /* non-standard! ignore parameter and return just time now, not generate tm_isdst, tm_yday, tm_wday == -1 */
|
|
||||||
double difftime (time_t end, time_t beginning);
|
|
||||||
|
|
||||||
extern struct tm __buffertime;
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,838 +0,0 @@
|
|||||||
/*
|
|
||||||
* The following constants come from Mesa
|
|
||||||
*/
|
|
||||||
#ifndef GL_H
|
|
||||||
#define GL_H
|
|
||||||
|
|
||||||
#define GL_VERSION_1_1 1
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
|
||||||
/* Boolean values */
|
|
||||||
GL_FALSE = 0,
|
|
||||||
GL_TRUE = 1,
|
|
||||||
|
|
||||||
/* Data types */
|
|
||||||
GL_BYTE = 0x1400,
|
|
||||||
GL_UNSIGNED_BYTE = 0x1401,
|
|
||||||
GL_SHORT = 0x1402,
|
|
||||||
GL_UNSIGNED_SHORT = 0x1403,
|
|
||||||
GL_INT = 0x1404,
|
|
||||||
GL_UNSIGNED_INT = 0x1405,
|
|
||||||
GL_FLOAT = 0x1406,
|
|
||||||
GL_DOUBLE = 0x140A,
|
|
||||||
GL_2_BYTES = 0x1407,
|
|
||||||
GL_3_BYTES = 0x1408,
|
|
||||||
GL_4_BYTES = 0x1409,
|
|
||||||
|
|
||||||
/* Primitives */
|
|
||||||
GL_LINES = 0x0001,
|
|
||||||
GL_POINTS = 0x0000,
|
|
||||||
GL_LINE_STRIP = 0x0003,
|
|
||||||
GL_LINE_LOOP = 0x0002,
|
|
||||||
GL_TRIANGLES = 0x0004,
|
|
||||||
GL_TRIANGLE_STRIP = 0x0005,
|
|
||||||
GL_TRIANGLE_FAN = 0x0006,
|
|
||||||
GL_QUADS = 0x0007,
|
|
||||||
GL_QUAD_STRIP = 0x0008,
|
|
||||||
GL_POLYGON = 0x0009,
|
|
||||||
GL_EDGE_FLAG = 0x0B43,
|
|
||||||
|
|
||||||
/* Vertex Arrays */
|
|
||||||
GL_VERTEX_ARRAY = 0x8074,
|
|
||||||
GL_NORMAL_ARRAY = 0x8075,
|
|
||||||
GL_COLOR_ARRAY = 0x8076,
|
|
||||||
GL_INDEX_ARRAY = 0x8077,
|
|
||||||
GL_TEXTURE_COORD_ARRAY = 0x8078,
|
|
||||||
GL_EDGE_FLAG_ARRAY = 0x8079,
|
|
||||||
GL_VERTEX_ARRAY_SIZE = 0x807A,
|
|
||||||
GL_VERTEX_ARRAY_TYPE = 0x807B,
|
|
||||||
GL_VERTEX_ARRAY_STRIDE = 0x807C,
|
|
||||||
GL_VERTEX_ARRAY_COUNT = 0x807D,
|
|
||||||
GL_NORMAL_ARRAY_TYPE = 0x807E,
|
|
||||||
GL_NORMAL_ARRAY_STRIDE = 0x807F,
|
|
||||||
GL_NORMAL_ARRAY_COUNT = 0x8080,
|
|
||||||
GL_COLOR_ARRAY_SIZE = 0x8081,
|
|
||||||
GL_COLOR_ARRAY_TYPE = 0x8082,
|
|
||||||
GL_COLOR_ARRAY_STRIDE = 0x8083,
|
|
||||||
GL_COLOR_ARRAY_COUNT = 0x8084,
|
|
||||||
GL_INDEX_ARRAY_TYPE = 0x8085,
|
|
||||||
GL_INDEX_ARRAY_STRIDE = 0x8086,
|
|
||||||
GL_INDEX_ARRAY_COUNT = 0x8087,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_COUNT = 0x808B,
|
|
||||||
GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C,
|
|
||||||
GL_EDGE_FLAG_ARRAY_COUNT = 0x808D,
|
|
||||||
GL_VERTEX_ARRAY_POINTER = 0x808E,
|
|
||||||
GL_NORMAL_ARRAY_POINTER = 0x808F,
|
|
||||||
GL_COLOR_ARRAY_POINTER = 0x8090,
|
|
||||||
GL_INDEX_ARRAY_POINTER = 0x8091,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092,
|
|
||||||
GL_EDGE_FLAG_ARRAY_POINTER = 0x8093,
|
|
||||||
GL_V2F = 0x2A20,
|
|
||||||
GL_V3F = 0x2A21,
|
|
||||||
GL_C4UB_V2F = 0x2A22,
|
|
||||||
GL_C4UB_V3F = 0x2A23,
|
|
||||||
GL_C3F_V3F = 0x2A24,
|
|
||||||
GL_N3F_V3F = 0x2A25,
|
|
||||||
GL_C4F_N3F_V3F = 0x2A26,
|
|
||||||
GL_T2F_V3F = 0x2A27,
|
|
||||||
GL_T4F_V4F = 0x2A28,
|
|
||||||
GL_T2F_C4UB_V3F = 0x2A29,
|
|
||||||
GL_T2F_C3F_V3F = 0x2A2A,
|
|
||||||
GL_T2F_N3F_V3F = 0x2A2B,
|
|
||||||
GL_T2F_C4F_N3F_V3F = 0x2A2C,
|
|
||||||
GL_T4F_C4F_N3F_V4F = 0x2A2D,
|
|
||||||
|
|
||||||
/* Matrix Mode */
|
|
||||||
GL_MATRIX_MODE = 0x0BA0,
|
|
||||||
GL_MODELVIEW = 0x1700,
|
|
||||||
GL_PROJECTION = 0x1701,
|
|
||||||
GL_TEXTURE = 0x1702,
|
|
||||||
|
|
||||||
/* Points */
|
|
||||||
GL_POINT_SMOOTH = 0x0B10,
|
|
||||||
GL_POINT_SIZE = 0x0B11,
|
|
||||||
GL_POINT_SIZE_GRANULARITY = 0x0B13,
|
|
||||||
GL_POINT_SIZE_RANGE = 0x0B12,
|
|
||||||
|
|
||||||
/* Lines */
|
|
||||||
GL_LINE_SMOOTH = 0x0B20,
|
|
||||||
GL_LINE_STIPPLE = 0x0B24,
|
|
||||||
GL_LINE_STIPPLE_PATTERN = 0x0B25,
|
|
||||||
GL_LINE_STIPPLE_REPEAT = 0x0B26,
|
|
||||||
GL_LINE_WIDTH = 0x0B21,
|
|
||||||
GL_LINE_WIDTH_GRANULARITY = 0x0B23,
|
|
||||||
GL_LINE_WIDTH_RANGE = 0x0B22,
|
|
||||||
|
|
||||||
/* Polygons */
|
|
||||||
GL_POINT = 0x1B00,
|
|
||||||
GL_LINE = 0x1B01,
|
|
||||||
GL_FILL = 0x1B02,
|
|
||||||
GL_CCW = 0x0901,
|
|
||||||
GL_CW = 0x0900,
|
|
||||||
GL_FRONT = 0x0404,
|
|
||||||
GL_BACK = 0x0405,
|
|
||||||
GL_CULL_FACE = 0x0B44,
|
|
||||||
GL_CULL_FACE_MODE = 0x0B45,
|
|
||||||
GL_POLYGON_SMOOTH = 0x0B41,
|
|
||||||
GL_POLYGON_STIPPLE = 0x0B42,
|
|
||||||
GL_FRONT_FACE = 0x0B46,
|
|
||||||
GL_POLYGON_MODE = 0x0B40,
|
|
||||||
GL_POLYGON_OFFSET_FACTOR = 0x3038,
|
|
||||||
GL_POLYGON_OFFSET_UNITS = 0x2A00,
|
|
||||||
GL_POLYGON_OFFSET_POINT = 0x2A01,
|
|
||||||
GL_POLYGON_OFFSET_LINE = 0x2A02,
|
|
||||||
GL_POLYGON_OFFSET_FILL = 0x8037,
|
|
||||||
|
|
||||||
/* Display Lists */
|
|
||||||
GL_COMPILE = 0x1300,
|
|
||||||
GL_COMPILE_AND_EXECUTE = 0x1301,
|
|
||||||
GL_LIST_BASE = 0x0B32,
|
|
||||||
GL_LIST_INDEX = 0x0B33,
|
|
||||||
GL_LIST_MODE = 0x0B30,
|
|
||||||
|
|
||||||
/* Depth buffer */
|
|
||||||
GL_NEVER = 0x0200,
|
|
||||||
GL_LESS = 0x0201,
|
|
||||||
GL_GEQUAL = 0x0206,
|
|
||||||
GL_LEQUAL = 0x0203,
|
|
||||||
GL_GREATER = 0x0204,
|
|
||||||
GL_NOTEQUAL = 0x0205,
|
|
||||||
GL_EQUAL = 0x0202,
|
|
||||||
GL_ALWAYS = 0x0207,
|
|
||||||
GL_DEPTH_TEST = 0x0B71,
|
|
||||||
GL_DEPTH_BITS = 0x0D56,
|
|
||||||
GL_DEPTH_CLEAR_VALUE = 0x0B73,
|
|
||||||
GL_DEPTH_FUNC = 0x0B74,
|
|
||||||
GL_DEPTH_RANGE = 0x0B70,
|
|
||||||
GL_DEPTH_WRITEMASK = 0x0B72,
|
|
||||||
GL_DEPTH_COMPONENT = 0x1902,
|
|
||||||
|
|
||||||
/* Lighting */
|
|
||||||
GL_LIGHTING = 0x0B50,
|
|
||||||
GL_LIGHT0 = 0x4000,
|
|
||||||
GL_LIGHT1 = 0x4001,
|
|
||||||
GL_LIGHT2 = 0x4002,
|
|
||||||
GL_LIGHT3 = 0x4003,
|
|
||||||
GL_LIGHT4 = 0x4004,
|
|
||||||
GL_LIGHT5 = 0x4005,
|
|
||||||
GL_LIGHT6 = 0x4006,
|
|
||||||
GL_LIGHT7 = 0x4007,
|
|
||||||
GL_SPOT_EXPONENT = 0x1205,
|
|
||||||
GL_SPOT_CUTOFF = 0x1206,
|
|
||||||
GL_CONSTANT_ATTENUATION = 0x1207,
|
|
||||||
GL_LINEAR_ATTENUATION = 0x1208,
|
|
||||||
GL_QUADRATIC_ATTENUATION = 0x1209,
|
|
||||||
GL_AMBIENT = 0x1200,
|
|
||||||
GL_DIFFUSE = 0x1201,
|
|
||||||
GL_SPECULAR = 0x1202,
|
|
||||||
GL_SHININESS = 0x1601,
|
|
||||||
GL_EMISSION = 0x1600,
|
|
||||||
GL_POSITION = 0x1203,
|
|
||||||
GL_SPOT_DIRECTION = 0x1204,
|
|
||||||
GL_AMBIENT_AND_DIFFUSE = 0x1602,
|
|
||||||
GL_COLOR_INDEXES = 0x1603,
|
|
||||||
GL_LIGHT_MODEL_TWO_SIDE = 0x0B52,
|
|
||||||
GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51,
|
|
||||||
GL_LIGHT_MODEL_AMBIENT = 0x0B53,
|
|
||||||
GL_FRONT_AND_BACK = 0x0408,
|
|
||||||
GL_SHADE_MODEL = 0x0B54,
|
|
||||||
GL_FLAT = 0x1D00,
|
|
||||||
GL_SMOOTH = 0x1D01,
|
|
||||||
GL_COLOR_MATERIAL = 0x0B57,
|
|
||||||
GL_COLOR_MATERIAL_FACE = 0x0B55,
|
|
||||||
GL_COLOR_MATERIAL_PARAMETER = 0x0B56,
|
|
||||||
GL_NORMALIZE = 0x0BA1,
|
|
||||||
|
|
||||||
/* User clipping planes */
|
|
||||||
GL_CLIP_PLANE0 = 0x3000,
|
|
||||||
GL_CLIP_PLANE1 = 0x3001,
|
|
||||||
GL_CLIP_PLANE2 = 0x3002,
|
|
||||||
GL_CLIP_PLANE3 = 0x3003,
|
|
||||||
GL_CLIP_PLANE4 = 0x3004,
|
|
||||||
GL_CLIP_PLANE5 = 0x3005,
|
|
||||||
|
|
||||||
/* Accumulation buffer */
|
|
||||||
GL_ACCUM_RED_BITS = 0x0D58,
|
|
||||||
GL_ACCUM_GREEN_BITS = 0x0D59,
|
|
||||||
GL_ACCUM_BLUE_BITS = 0x0D5A,
|
|
||||||
GL_ACCUM_ALPHA_BITS = 0x0D5B,
|
|
||||||
GL_ACCUM_CLEAR_VALUE = 0x0B80,
|
|
||||||
GL_ACCUM = 0x0100,
|
|
||||||
GL_ADD = 0x0104,
|
|
||||||
GL_LOAD = 0x0101,
|
|
||||||
GL_MULT = 0x0103,
|
|
||||||
GL_RETURN = 0x0102,
|
|
||||||
|
|
||||||
/* Alpha testing */
|
|
||||||
GL_ALPHA_TEST = 0x0BC0,
|
|
||||||
GL_ALPHA_TEST_REF = 0x0BC2,
|
|
||||||
GL_ALPHA_TEST_FUNC = 0x0BC1,
|
|
||||||
|
|
||||||
/* Blending */
|
|
||||||
GL_BLEND = 0x0BE2,
|
|
||||||
GL_BLEND_SRC = 0x0BE1,
|
|
||||||
GL_BLEND_DST = 0x0BE0,
|
|
||||||
GL_ZERO = 0,
|
|
||||||
GL_ONE = 1,
|
|
||||||
GL_SRC_COLOR = 0x0300,
|
|
||||||
GL_ONE_MINUS_SRC_COLOR = 0x0301,
|
|
||||||
GL_DST_COLOR = 0x0306,
|
|
||||||
GL_ONE_MINUS_DST_COLOR = 0x0307,
|
|
||||||
GL_SRC_ALPHA = 0x0302,
|
|
||||||
GL_ONE_MINUS_SRC_ALPHA = 0x0303,
|
|
||||||
GL_DST_ALPHA = 0x0304,
|
|
||||||
GL_ONE_MINUS_DST_ALPHA = 0x0305,
|
|
||||||
GL_SRC_ALPHA_SATURATE = 0x0308,
|
|
||||||
GL_CONSTANT_COLOR = 0x8001,
|
|
||||||
GL_ONE_MINUS_CONSTANT_COLOR = 0x8002,
|
|
||||||
GL_CONSTANT_ALPHA = 0x8003,
|
|
||||||
GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
|
|
||||||
|
|
||||||
/* Render Mode */
|
|
||||||
GL_FEEDBACK = 0x1C01,
|
|
||||||
GL_RENDER = 0x1C00,
|
|
||||||
GL_SELECT = 0x1C02,
|
|
||||||
|
|
||||||
/* Feedback */
|
|
||||||
GL_2D = 0x0600,
|
|
||||||
GL_3D = 0x0601,
|
|
||||||
GL_3D_COLOR = 0x0602,
|
|
||||||
GL_3D_COLOR_TEXTURE = 0x0603,
|
|
||||||
GL_4D_COLOR_TEXTURE = 0x0604,
|
|
||||||
GL_POINT_TOKEN = 0x0701,
|
|
||||||
GL_LINE_TOKEN = 0x0702,
|
|
||||||
GL_LINE_RESET_TOKEN = 0x0707,
|
|
||||||
GL_POLYGON_TOKEN = 0x0703,
|
|
||||||
GL_BITMAP_TOKEN = 0x0704,
|
|
||||||
GL_DRAW_PIXEL_TOKEN = 0x0705,
|
|
||||||
GL_COPY_PIXEL_TOKEN = 0x0706,
|
|
||||||
GL_PASS_THROUGH_TOKEN = 0x0700,
|
|
||||||
|
|
||||||
/* Fog */
|
|
||||||
GL_FOG = 0x0B60,
|
|
||||||
GL_FOG_MODE = 0x0B65,
|
|
||||||
GL_FOG_DENSITY = 0x0B62,
|
|
||||||
GL_FOG_COLOR = 0x0B66,
|
|
||||||
GL_FOG_INDEX = 0x0B61,
|
|
||||||
GL_FOG_START = 0x0B63,
|
|
||||||
GL_FOG_END = 0x0B64,
|
|
||||||
GL_LINEAR = 0x2601,
|
|
||||||
GL_EXP = 0x0800,
|
|
||||||
GL_EXP2 = 0x0801,
|
|
||||||
|
|
||||||
/* Logic Ops */
|
|
||||||
GL_LOGIC_OP = 0x0BF1,
|
|
||||||
GL_LOGIC_OP_MODE = 0x0BF0,
|
|
||||||
GL_CLEAR = 0x1500,
|
|
||||||
GL_SET = 0x150F,
|
|
||||||
GL_COPY = 0x1503,
|
|
||||||
GL_COPY_INVERTED = 0x150C,
|
|
||||||
GL_NOOP = 0x1505,
|
|
||||||
GL_INVERT = 0x150A,
|
|
||||||
GL_AND = 0x1501,
|
|
||||||
GL_NAND = 0x150E,
|
|
||||||
GL_OR = 0x1507,
|
|
||||||
GL_NOR = 0x1508,
|
|
||||||
GL_XOR = 0x1506,
|
|
||||||
GL_EQUIV = 0x1509,
|
|
||||||
GL_AND_REVERSE = 0x1502,
|
|
||||||
GL_AND_INVERTED = 0x1504,
|
|
||||||
GL_OR_REVERSE = 0x150B,
|
|
||||||
GL_OR_INVERTED = 0x150D,
|
|
||||||
|
|
||||||
/* Stencil */
|
|
||||||
GL_STENCIL_TEST = 0x0B90,
|
|
||||||
GL_STENCIL_WRITEMASK = 0x0B98,
|
|
||||||
GL_STENCIL_BITS = 0x0D57,
|
|
||||||
GL_STENCIL_FUNC = 0x0B92,
|
|
||||||
GL_STENCIL_VALUE_MASK = 0x0B93,
|
|
||||||
GL_STENCIL_REF = 0x0B97,
|
|
||||||
GL_STENCIL_FAIL = 0x0B94,
|
|
||||||
GL_STENCIL_PASS_DEPTH_PASS = 0x0B96,
|
|
||||||
GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95,
|
|
||||||
GL_STENCIL_CLEAR_VALUE = 0x0B91,
|
|
||||||
GL_STENCIL_INDEX = 0x1901,
|
|
||||||
GL_KEEP = 0x1E00,
|
|
||||||
GL_REPLACE = 0x1E01,
|
|
||||||
GL_INCR = 0x1E02,
|
|
||||||
GL_DECR = 0x1E03,
|
|
||||||
|
|
||||||
/* Buffers, Pixel Drawing/Reading */
|
|
||||||
GL_NONE = 0,
|
|
||||||
GL_LEFT = 0x0406,
|
|
||||||
GL_RIGHT = 0x0407,
|
|
||||||
/*GL_FRONT = 0x0404, */
|
|
||||||
/*GL_BACK = 0x0405, */
|
|
||||||
/*GL_FRONT_AND_BACK = 0x0408, */
|
|
||||||
GL_FRONT_LEFT = 0x0400,
|
|
||||||
GL_FRONT_RIGHT = 0x0401,
|
|
||||||
GL_BACK_LEFT = 0x0402,
|
|
||||||
GL_BACK_RIGHT = 0x0403,
|
|
||||||
GL_AUX0 = 0x0409,
|
|
||||||
GL_AUX1 = 0x040A,
|
|
||||||
GL_AUX2 = 0x040B,
|
|
||||||
GL_AUX3 = 0x040C,
|
|
||||||
GL_COLOR_INDEX = 0x1900,
|
|
||||||
GL_RED = 0x1903,
|
|
||||||
GL_GREEN = 0x1904,
|
|
||||||
GL_BLUE = 0x1905,
|
|
||||||
GL_ALPHA = 0x1906,
|
|
||||||
GL_LUMINANCE = 0x1909,
|
|
||||||
GL_LUMINANCE_ALPHA = 0x190A,
|
|
||||||
GL_ALPHA_BITS = 0x0D55,
|
|
||||||
GL_RED_BITS = 0x0D52,
|
|
||||||
GL_GREEN_BITS = 0x0D53,
|
|
||||||
GL_BLUE_BITS = 0x0D54,
|
|
||||||
GL_INDEX_BITS = 0x0D51,
|
|
||||||
GL_SUBPIXEL_BITS = 0x0D50,
|
|
||||||
GL_AUX_BUFFERS = 0x0C00,
|
|
||||||
GL_READ_BUFFER = 0x0C02,
|
|
||||||
GL_DRAW_BUFFER = 0x0C01,
|
|
||||||
GL_DOUBLEBUFFER = 0x0C32,
|
|
||||||
GL_STEREO = 0x0C33,
|
|
||||||
GL_BITMAP = 0x1A00,
|
|
||||||
GL_COLOR = 0x1800,
|
|
||||||
GL_DEPTH = 0x1801,
|
|
||||||
GL_STENCIL = 0x1802,
|
|
||||||
GL_DITHER = 0x0BD0,
|
|
||||||
GL_RGB = 0x1907,
|
|
||||||
GL_RGBA = 0x1908,
|
|
||||||
|
|
||||||
/* Implementation limits */
|
|
||||||
GL_MAX_LIST_NESTING = 0x0B31,
|
|
||||||
GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35,
|
|
||||||
GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36,
|
|
||||||
GL_MAX_NAME_STACK_DEPTH = 0x0D37,
|
|
||||||
GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38,
|
|
||||||
GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39,
|
|
||||||
GL_MAX_EVAL_ORDER = 0x0D30,
|
|
||||||
GL_MAX_LIGHTS = 0x0D31,
|
|
||||||
GL_MAX_CLIP_PLANES = 0x0D32,
|
|
||||||
GL_MAX_TEXTURE_SIZE = 0x0D33,
|
|
||||||
GL_MAX_PIXEL_MAP_TABLE = 0x0D34,
|
|
||||||
GL_MAX_VIEWPORT_DIMS = 0x0D3A,
|
|
||||||
GL_MAX_CLIENT_ATTRIB_STACK_DEPTH= 0x0D3B,
|
|
||||||
|
|
||||||
/* Gets */
|
|
||||||
GL_ATTRIB_STACK_DEPTH = 0x0BB0,
|
|
||||||
GL_COLOR_CLEAR_VALUE = 0x0C22,
|
|
||||||
GL_COLOR_WRITEMASK = 0x0C23,
|
|
||||||
GL_CURRENT_INDEX = 0x0B01,
|
|
||||||
GL_CURRENT_COLOR = 0x0B00,
|
|
||||||
GL_CURRENT_NORMAL = 0x0B02,
|
|
||||||
GL_CURRENT_RASTER_COLOR = 0x0B04,
|
|
||||||
GL_CURRENT_RASTER_DISTANCE = 0x0B09,
|
|
||||||
GL_CURRENT_RASTER_INDEX = 0x0B05,
|
|
||||||
GL_CURRENT_RASTER_POSITION = 0x0B07,
|
|
||||||
GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06,
|
|
||||||
GL_CURRENT_RASTER_POSITION_VALID = 0x0B08,
|
|
||||||
GL_CURRENT_TEXTURE_COORDS = 0x0B03,
|
|
||||||
GL_INDEX_CLEAR_VALUE = 0x0C20,
|
|
||||||
GL_INDEX_MODE = 0x0C30,
|
|
||||||
GL_INDEX_WRITEMASK = 0x0C21,
|
|
||||||
GL_MODELVIEW_MATRIX = 0x0BA6,
|
|
||||||
GL_MODELVIEW_STACK_DEPTH = 0x0BA3,
|
|
||||||
GL_NAME_STACK_DEPTH = 0x0D70,
|
|
||||||
GL_PROJECTION_MATRIX = 0x0BA7,
|
|
||||||
GL_PROJECTION_STACK_DEPTH = 0x0BA4,
|
|
||||||
GL_RENDER_MODE = 0x0C40,
|
|
||||||
GL_RGBA_MODE = 0x0C31,
|
|
||||||
GL_TEXTURE_MATRIX = 0x0BA8,
|
|
||||||
GL_TEXTURE_STACK_DEPTH = 0x0BA5,
|
|
||||||
GL_VIEWPORT = 0x0BA2,
|
|
||||||
|
|
||||||
|
|
||||||
/* Evaluators */
|
|
||||||
GL_AUTO_NORMAL = 0x0D80,
|
|
||||||
GL_MAP1_COLOR_4 = 0x0D90,
|
|
||||||
GL_MAP1_GRID_DOMAIN = 0x0DD0,
|
|
||||||
GL_MAP1_GRID_SEGMENTS = 0x0DD1,
|
|
||||||
GL_MAP1_INDEX = 0x0D91,
|
|
||||||
GL_MAP1_NORMAL = 0x0D92,
|
|
||||||
GL_MAP1_TEXTURE_COORD_1 = 0x0D93,
|
|
||||||
GL_MAP1_TEXTURE_COORD_2 = 0x0D94,
|
|
||||||
GL_MAP1_TEXTURE_COORD_3 = 0x0D95,
|
|
||||||
GL_MAP1_TEXTURE_COORD_4 = 0x0D96,
|
|
||||||
GL_MAP1_VERTEX_3 = 0x0D97,
|
|
||||||
GL_MAP1_VERTEX_4 = 0x0D98,
|
|
||||||
GL_MAP2_COLOR_4 = 0x0DB0,
|
|
||||||
GL_MAP2_GRID_DOMAIN = 0x0DD2,
|
|
||||||
GL_MAP2_GRID_SEGMENTS = 0x0DD3,
|
|
||||||
GL_MAP2_INDEX = 0x0DB1,
|
|
||||||
GL_MAP2_NORMAL = 0x0DB2,
|
|
||||||
GL_MAP2_TEXTURE_COORD_1 = 0x0DB3,
|
|
||||||
GL_MAP2_TEXTURE_COORD_2 = 0x0DB4,
|
|
||||||
GL_MAP2_TEXTURE_COORD_3 = 0x0DB5,
|
|
||||||
GL_MAP2_TEXTURE_COORD_4 = 0x0DB6,
|
|
||||||
GL_MAP2_VERTEX_3 = 0x0DB7,
|
|
||||||
GL_MAP2_VERTEX_4 = 0x0DB8,
|
|
||||||
GL_COEFF = 0x0A00,
|
|
||||||
GL_DOMAIN = 0x0A02,
|
|
||||||
GL_ORDER = 0x0A01,
|
|
||||||
|
|
||||||
/* Hints */
|
|
||||||
GL_FOG_HINT = 0x0C54,
|
|
||||||
GL_LINE_SMOOTH_HINT = 0x0C52,
|
|
||||||
GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50,
|
|
||||||
GL_POINT_SMOOTH_HINT = 0x0C51,
|
|
||||||
GL_POLYGON_SMOOTH_HINT = 0x0C53,
|
|
||||||
GL_DONT_CARE = 0x1100,
|
|
||||||
GL_FASTEST = 0x1101,
|
|
||||||
GL_NICEST = 0x1102,
|
|
||||||
|
|
||||||
/* Scissor box */
|
|
||||||
GL_SCISSOR_TEST = 0x0C11,
|
|
||||||
GL_SCISSOR_BOX = 0x0C10,
|
|
||||||
|
|
||||||
/* Pixel Mode / Transfer */
|
|
||||||
GL_MAP_COLOR = 0x0D10,
|
|
||||||
GL_MAP_STENCIL = 0x0D11,
|
|
||||||
GL_INDEX_SHIFT = 0x0D12,
|
|
||||||
GL_INDEX_OFFSET = 0x0D13,
|
|
||||||
GL_RED_SCALE = 0x0D14,
|
|
||||||
GL_RED_BIAS = 0x0D15,
|
|
||||||
GL_GREEN_SCALE = 0x0D18,
|
|
||||||
GL_GREEN_BIAS = 0x0D19,
|
|
||||||
GL_BLUE_SCALE = 0x0D1A,
|
|
||||||
GL_BLUE_BIAS = 0x0D1B,
|
|
||||||
GL_ALPHA_SCALE = 0x0D1C,
|
|
||||||
GL_ALPHA_BIAS = 0x0D1D,
|
|
||||||
GL_DEPTH_SCALE = 0x0D1E,
|
|
||||||
GL_DEPTH_BIAS = 0x0D1F,
|
|
||||||
GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1,
|
|
||||||
GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0,
|
|
||||||
GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2,
|
|
||||||
GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3,
|
|
||||||
GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4,
|
|
||||||
GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5,
|
|
||||||
GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6,
|
|
||||||
GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7,
|
|
||||||
GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8,
|
|
||||||
GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9,
|
|
||||||
GL_PIXEL_MAP_S_TO_S = 0x0C71,
|
|
||||||
GL_PIXEL_MAP_I_TO_I = 0x0C70,
|
|
||||||
GL_PIXEL_MAP_I_TO_R = 0x0C72,
|
|
||||||
GL_PIXEL_MAP_I_TO_G = 0x0C73,
|
|
||||||
GL_PIXEL_MAP_I_TO_B = 0x0C74,
|
|
||||||
GL_PIXEL_MAP_I_TO_A = 0x0C75,
|
|
||||||
GL_PIXEL_MAP_R_TO_R = 0x0C76,
|
|
||||||
GL_PIXEL_MAP_G_TO_G = 0x0C77,
|
|
||||||
GL_PIXEL_MAP_B_TO_B = 0x0C78,
|
|
||||||
GL_PIXEL_MAP_A_TO_A = 0x0C79,
|
|
||||||
GL_PACK_ALIGNMENT = 0x0D05,
|
|
||||||
GL_PACK_LSB_FIRST = 0x0D01,
|
|
||||||
GL_PACK_ROW_LENGTH = 0x0D02,
|
|
||||||
GL_PACK_SKIP_PIXELS = 0x0D04,
|
|
||||||
GL_PACK_SKIP_ROWS = 0x0D03,
|
|
||||||
GL_PACK_SWAP_BYTES = 0x0D00,
|
|
||||||
GL_UNPACK_ALIGNMENT = 0x0CF5,
|
|
||||||
GL_UNPACK_LSB_FIRST = 0x0CF1,
|
|
||||||
GL_UNPACK_ROW_LENGTH = 0x0CF2,
|
|
||||||
GL_UNPACK_SKIP_PIXELS = 0x0CF4,
|
|
||||||
GL_UNPACK_SKIP_ROWS = 0x0CF3,
|
|
||||||
GL_UNPACK_SWAP_BYTES = 0x0CF0,
|
|
||||||
GL_ZOOM_X = 0x0D16,
|
|
||||||
GL_ZOOM_Y = 0x0D17,
|
|
||||||
|
|
||||||
/* Texture mapping */
|
|
||||||
GL_TEXTURE_ENV = 0x2300,
|
|
||||||
GL_TEXTURE_ENV_MODE = 0x2200,
|
|
||||||
GL_TEXTURE_1D = 0x0DE0,
|
|
||||||
GL_TEXTURE_2D = 0x0DE1,
|
|
||||||
GL_TEXTURE_WRAP_S = 0x2802,
|
|
||||||
GL_TEXTURE_WRAP_T = 0x2803,
|
|
||||||
GL_TEXTURE_MAG_FILTER = 0x2800,
|
|
||||||
GL_TEXTURE_MIN_FILTER = 0x2801,
|
|
||||||
GL_TEXTURE_ENV_COLOR = 0x2201,
|
|
||||||
GL_TEXTURE_GEN_S = 0x0C60,
|
|
||||||
GL_TEXTURE_GEN_T = 0x0C61,
|
|
||||||
GL_TEXTURE_GEN_MODE = 0x2500,
|
|
||||||
GL_TEXTURE_BORDER_COLOR = 0x1004,
|
|
||||||
GL_TEXTURE_WIDTH = 0x1000,
|
|
||||||
GL_TEXTURE_HEIGHT = 0x1001,
|
|
||||||
GL_TEXTURE_BORDER = 0x1005,
|
|
||||||
GL_TEXTURE_COMPONENTS = 0x1003,
|
|
||||||
GL_NEAREST_MIPMAP_NEAREST = 0x2700,
|
|
||||||
GL_NEAREST_MIPMAP_LINEAR = 0x2702,
|
|
||||||
GL_LINEAR_MIPMAP_NEAREST = 0x2701,
|
|
||||||
GL_LINEAR_MIPMAP_LINEAR = 0x2703,
|
|
||||||
GL_OBJECT_LINEAR = 0x2401,
|
|
||||||
GL_OBJECT_PLANE = 0x2501,
|
|
||||||
GL_EYE_LINEAR = 0x2400,
|
|
||||||
GL_EYE_PLANE = 0x2502,
|
|
||||||
GL_SPHERE_MAP = 0x2402,
|
|
||||||
GL_DECAL = 0x2101,
|
|
||||||
GL_MODULATE = 0x2100,
|
|
||||||
GL_NEAREST = 0x2600,
|
|
||||||
GL_REPEAT = 0x2901,
|
|
||||||
GL_CLAMP = 0x2900,
|
|
||||||
GL_S = 0x2000,
|
|
||||||
GL_T = 0x2001,
|
|
||||||
GL_R = 0x2002,
|
|
||||||
GL_Q = 0x2003,
|
|
||||||
GL_TEXTURE_GEN_R = 0x0C62,
|
|
||||||
GL_TEXTURE_GEN_Q = 0x0C63,
|
|
||||||
|
|
||||||
GL_PROXY_TEXTURE_1D = 0x8063,
|
|
||||||
GL_PROXY_TEXTURE_2D = 0x8064,
|
|
||||||
GL_TEXTURE_PRIORITY = 0x8066,
|
|
||||||
GL_TEXTURE_RESIDENT = 0x8067,
|
|
||||||
GL_TEXTURE_1D_BINDING = 0x8068,
|
|
||||||
GL_TEXTURE_2D_BINDING = 0x8069,
|
|
||||||
|
|
||||||
/* Internal texture formats */
|
|
||||||
GL_ALPHA4 = 0x803B,
|
|
||||||
GL_ALPHA8 = 0x803C,
|
|
||||||
GL_ALPHA12 = 0x803D,
|
|
||||||
GL_ALPHA16 = 0x803E,
|
|
||||||
GL_LUMINANCE4 = 0x803F,
|
|
||||||
GL_LUMINANCE8 = 0x8040,
|
|
||||||
GL_LUMINANCE12 = 0x8041,
|
|
||||||
GL_LUMINANCE16 = 0x8042,
|
|
||||||
GL_LUMINANCE4_ALPHA4 = 0x8043,
|
|
||||||
GL_LUMINANCE6_ALPHA2 = 0x8044,
|
|
||||||
GL_LUMINANCE8_ALPHA8 = 0x8045,
|
|
||||||
GL_LUMINANCE12_ALPHA4 = 0x8046,
|
|
||||||
GL_LUMINANCE12_ALPHA12 = 0x8047,
|
|
||||||
GL_LUMINANCE16_ALPHA16 = 0x8048,
|
|
||||||
GL_INTENSITY = 0x8049,
|
|
||||||
GL_INTENSITY4 = 0x804A,
|
|
||||||
GL_INTENSITY8 = 0x804B,
|
|
||||||
GL_INTENSITY12 = 0x804C,
|
|
||||||
GL_INTENSITY16 = 0x804D,
|
|
||||||
GL_R3_G3_B2 = 0x2A10,
|
|
||||||
GL_RGB4 = 0x804F,
|
|
||||||
GL_RGB5 = 0x8050,
|
|
||||||
GL_RGB8 = 0x8051,
|
|
||||||
GL_RGB10 = 0x8052,
|
|
||||||
GL_RGB12 = 0x8053,
|
|
||||||
GL_RGB16 = 0x8054,
|
|
||||||
GL_RGBA2 = 0x8055,
|
|
||||||
GL_RGBA4 = 0x8056,
|
|
||||||
GL_RGB5_A1 = 0x8057,
|
|
||||||
GL_RGBA8 = 0x8058,
|
|
||||||
GL_RGB10_A2 = 0x8059,
|
|
||||||
GL_RGBA12 = 0x805A,
|
|
||||||
GL_RGBA16 = 0x805B,
|
|
||||||
|
|
||||||
/* Utility */
|
|
||||||
GL_VENDOR = 0x1F00,
|
|
||||||
GL_RENDERER = 0x1F01,
|
|
||||||
GL_VERSION = 0x1F02,
|
|
||||||
GL_EXTENSIONS = 0x1F03,
|
|
||||||
|
|
||||||
/* Errors */
|
|
||||||
GL_INVALID_VALUE = 0x0501,
|
|
||||||
GL_INVALID_ENUM = 0x0500,
|
|
||||||
GL_INVALID_OPERATION = 0x0502,
|
|
||||||
GL_STACK_OVERFLOW = 0x0503,
|
|
||||||
GL_STACK_UNDERFLOW = 0x0504,
|
|
||||||
GL_OUT_OF_MEMORY = 0x0505,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 1.0 Extensions
|
|
||||||
*/
|
|
||||||
/* GL_EXT_blend_minmax and GL_EXT_blend_color */
|
|
||||||
GL_CONSTANT_COLOR_EXT = 0x8001,
|
|
||||||
GL_ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002,
|
|
||||||
GL_CONSTANT_ALPHA_EXT = 0x8003,
|
|
||||||
GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004,
|
|
||||||
GL_BLEND_EQUATION_EXT = 0x8009,
|
|
||||||
GL_MIN_EXT = 0x8007,
|
|
||||||
GL_MAX_EXT = 0x8008,
|
|
||||||
GL_FUNC_ADD_EXT = 0x8006,
|
|
||||||
GL_FUNC_SUBTRACT_EXT = 0x800A,
|
|
||||||
GL_FUNC_REVERSE_SUBTRACT_EXT = 0x800B,
|
|
||||||
GL_BLEND_COLOR_EXT = 0x8005,
|
|
||||||
|
|
||||||
/* GL_EXT_polygon_offset */
|
|
||||||
GL_POLYGON_OFFSET_EXT = 0x8037,
|
|
||||||
GL_POLYGON_OFFSET_FACTOR_EXT = 0x8038,
|
|
||||||
GL_POLYGON_OFFSET_BIAS_EXT = 0x8039,
|
|
||||||
|
|
||||||
/* GL_EXT_vertex_array */
|
|
||||||
GL_VERTEX_ARRAY_EXT = 0x8074,
|
|
||||||
GL_NORMAL_ARRAY_EXT = 0x8075,
|
|
||||||
GL_COLOR_ARRAY_EXT = 0x8076,
|
|
||||||
GL_INDEX_ARRAY_EXT = 0x8077,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_EXT = 0x8078,
|
|
||||||
GL_EDGE_FLAG_ARRAY_EXT = 0x8079,
|
|
||||||
GL_VERTEX_ARRAY_SIZE_EXT = 0x807A,
|
|
||||||
GL_VERTEX_ARRAY_TYPE_EXT = 0x807B,
|
|
||||||
GL_VERTEX_ARRAY_STRIDE_EXT = 0x807C,
|
|
||||||
GL_VERTEX_ARRAY_COUNT_EXT = 0x807D,
|
|
||||||
GL_NORMAL_ARRAY_TYPE_EXT = 0x807E,
|
|
||||||
GL_NORMAL_ARRAY_STRIDE_EXT = 0x807F,
|
|
||||||
GL_NORMAL_ARRAY_COUNT_EXT = 0x8080,
|
|
||||||
GL_COLOR_ARRAY_SIZE_EXT = 0x8081,
|
|
||||||
GL_COLOR_ARRAY_TYPE_EXT = 0x8082,
|
|
||||||
GL_COLOR_ARRAY_STRIDE_EXT = 0x8083,
|
|
||||||
GL_COLOR_ARRAY_COUNT_EXT = 0x8084,
|
|
||||||
GL_INDEX_ARRAY_TYPE_EXT = 0x8085,
|
|
||||||
GL_INDEX_ARRAY_STRIDE_EXT = 0x8086,
|
|
||||||
GL_INDEX_ARRAY_COUNT_EXT = 0x8087,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_STRIDE_EXT= 0x808A,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_COUNT_EXT= 0x808B,
|
|
||||||
GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C,
|
|
||||||
GL_EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D,
|
|
||||||
GL_VERTEX_ARRAY_POINTER_EXT = 0x808E,
|
|
||||||
GL_NORMAL_ARRAY_POINTER_EXT = 0x808F,
|
|
||||||
GL_COLOR_ARRAY_POINTER_EXT = 0x8090,
|
|
||||||
GL_INDEX_ARRAY_POINTER_EXT = 0x8091,
|
|
||||||
GL_TEXTURE_COORD_ARRAY_POINTER_EXT= 0x8092,
|
|
||||||
GL_EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
GL_CURRENT_BIT = 0x00000001,
|
|
||||||
GL_POINT_BIT = 0x00000002,
|
|
||||||
GL_LINE_BIT = 0x00000004,
|
|
||||||
GL_POLYGON_BIT = 0x00000008,
|
|
||||||
GL_POLYGON_STIPPLE_BIT = 0x00000010,
|
|
||||||
GL_PIXEL_MODE_BIT = 0x00000020,
|
|
||||||
GL_LIGHTING_BIT = 0x00000040,
|
|
||||||
GL_FOG_BIT = 0x00000080,
|
|
||||||
GL_DEPTH_BUFFER_BIT = 0x00000100,
|
|
||||||
GL_ACCUM_BUFFER_BIT = 0x00000200,
|
|
||||||
GL_STENCIL_BUFFER_BIT = 0x00000400,
|
|
||||||
GL_VIEWPORT_BIT = 0x00000800,
|
|
||||||
GL_TRANSFORM_BIT = 0x00001000,
|
|
||||||
GL_ENABLE_BIT = 0x00002000,
|
|
||||||
GL_COLOR_BUFFER_BIT = 0x00004000,
|
|
||||||
GL_HINT_BIT = 0x00008000,
|
|
||||||
GL_EVAL_BIT = 0x00010000,
|
|
||||||
GL_LIST_BIT = 0x00020000,
|
|
||||||
GL_TEXTURE_BIT = 0x00040000,
|
|
||||||
GL_SCISSOR_BIT = 0x00080000,
|
|
||||||
GL_ALL_ATTRIB_BITS = 0x000fffff
|
|
||||||
};
|
|
||||||
|
|
||||||
/* some types */
|
|
||||||
|
|
||||||
typedef int GLenum;
|
|
||||||
typedef void GLvoid;
|
|
||||||
typedef unsigned char GLboolean;
|
|
||||||
typedef signed char GLbyte; /* 1-byte signed */
|
|
||||||
typedef short GLshort; /* 2-byte signed */
|
|
||||||
typedef int GLint; /* 4-byte signed */
|
|
||||||
typedef unsigned char GLubyte; /* 1-byte unsigned */
|
|
||||||
typedef unsigned short GLushort; /* 2-byte unsigned */
|
|
||||||
typedef unsigned int GLuint; /* 4-byte unsigned */
|
|
||||||
typedef float GLfloat; /* single precision float */
|
|
||||||
typedef double GLdouble; /* double precision float */
|
|
||||||
typedef int GLsizei;
|
|
||||||
|
|
||||||
/* functions */
|
|
||||||
|
|
||||||
void glEnable(int code);
|
|
||||||
void glDisable(int code);
|
|
||||||
|
|
||||||
void glShadeModel(int mode);
|
|
||||||
void glCullFace(int mode);
|
|
||||||
void glPolygonMode(int face,int mode);
|
|
||||||
|
|
||||||
void glBegin(int type);
|
|
||||||
void glEnd(void);
|
|
||||||
|
|
||||||
#define PROTO_GL1(name) \
|
|
||||||
void gl ## name ## 1f(float); \
|
|
||||||
void gl ## name ## 1d(double); \
|
|
||||||
void gl ## name ## 1fv(float *); \
|
|
||||||
void gl ## name ## 1dv(double *);
|
|
||||||
|
|
||||||
#define PROTO_GL2(name) \
|
|
||||||
void gl ## name ## 2f(float ,float); \
|
|
||||||
void gl ## name ## 2d(double ,double); \
|
|
||||||
void gl ## name ## 2fv(float *); \
|
|
||||||
void gl ## name ## 2dv(double *);
|
|
||||||
|
|
||||||
#define PROTO_GL3(name) \
|
|
||||||
void gl ## name ## 3f(float ,float ,float); \
|
|
||||||
void gl ## name ## 3d(double ,double ,double); \
|
|
||||||
void gl ## name ## 3fv(float *); \
|
|
||||||
void gl ## name ## 3dv(double *);
|
|
||||||
|
|
||||||
#define PROTO_GL4(name) \
|
|
||||||
void gl ## name ## 4f(float ,float ,float, float ); \
|
|
||||||
void gl ## name ## 4d(double ,double ,double, double ); \
|
|
||||||
void gl ## name ## 4fv(float *); \
|
|
||||||
void gl ## name ## 4dv(double *);
|
|
||||||
|
|
||||||
PROTO_GL2(Vertex)
|
|
||||||
PROTO_GL3(Vertex)
|
|
||||||
PROTO_GL4(Vertex)
|
|
||||||
|
|
||||||
PROTO_GL3(Color)
|
|
||||||
PROTO_GL4(Color)
|
|
||||||
|
|
||||||
PROTO_GL3(Normal)
|
|
||||||
|
|
||||||
PROTO_GL1(TexCoord)
|
|
||||||
PROTO_GL2(TexCoord)
|
|
||||||
PROTO_GL3(TexCoord)
|
|
||||||
PROTO_GL4(TexCoord)
|
|
||||||
|
|
||||||
void glEdgeFlag(int flag);
|
|
||||||
|
|
||||||
/* matrix */
|
|
||||||
void glMatrixMode(int mode);
|
|
||||||
void glLoadMatrixf(const float *m);
|
|
||||||
void glLoadIdentity(void);
|
|
||||||
void glMultMatrixf(const float *m);
|
|
||||||
void glPushMatrix(void);
|
|
||||||
void glPopMatrix(void);
|
|
||||||
void glRotatef(float angle,float x,float y,float z);
|
|
||||||
void glTranslatef(float x,float y,float z);
|
|
||||||
void glScalef(float x,float y,float z);
|
|
||||||
|
|
||||||
void glViewport(int x,int y,int width,int height);
|
|
||||||
void glFrustum(double left,double right,double bottom,double top,
|
|
||||||
double near_,double far_);
|
|
||||||
|
|
||||||
/* lists */
|
|
||||||
unsigned int glGenLists(int range);
|
|
||||||
int glIsList(unsigned int list);
|
|
||||||
void glNewList(unsigned int list,int mode);
|
|
||||||
void glEndList(void);
|
|
||||||
void glCallList(unsigned int list);
|
|
||||||
|
|
||||||
/* clear */
|
|
||||||
void glClear(int mask);
|
|
||||||
void glClearColor(float r,float g,float b,float a);
|
|
||||||
void glClearDepth(double depth);
|
|
||||||
|
|
||||||
/* selection */
|
|
||||||
int glRenderMode(int mode);
|
|
||||||
void glSelectBuffer(int size,unsigned int *buf);
|
|
||||||
|
|
||||||
void glInitNames(void);
|
|
||||||
void glPushName(unsigned int name);
|
|
||||||
void glPopName(void);
|
|
||||||
void glLoadName(unsigned int name);
|
|
||||||
|
|
||||||
/* textures */
|
|
||||||
void glGenTextures(int n, unsigned int *textures);
|
|
||||||
void glDeleteTextures(int n, const unsigned int *textures);
|
|
||||||
void glBindTexture(int target,int texture);
|
|
||||||
void glTexImage2D( int target, int level, int components,
|
|
||||||
int width, int height, int border,
|
|
||||||
int format, int type, void *pixels);
|
|
||||||
void glTexEnvi(int target,int pname,int param);
|
|
||||||
void glTexParameteri(int target,int pname,int param);
|
|
||||||
void glPixelStorei(int pname,int param);
|
|
||||||
|
|
||||||
/* lighting */
|
|
||||||
|
|
||||||
void glMaterialfv(int mode,int type,float *v);
|
|
||||||
void glMaterialf(int mode,int type,float v);
|
|
||||||
void glColorMaterial(int mode,int type);
|
|
||||||
|
|
||||||
void glLightfv(int light,int type,float *v);
|
|
||||||
void glLightf(int light,int type,float v);
|
|
||||||
void glLightModeli(int pname,int param);
|
|
||||||
void glLightModelfv(int pname,float *param);
|
|
||||||
|
|
||||||
/* misc */
|
|
||||||
|
|
||||||
void glFlush(void);
|
|
||||||
void glHint(int target,int mode);
|
|
||||||
void glGetIntegerv(int pname,int *params);
|
|
||||||
void glGetFloatv(int pname, float *v);
|
|
||||||
void glFrontFace(int mode);
|
|
||||||
|
|
||||||
/* opengl 1.2 arrays */
|
|
||||||
void glEnableClientState(GLenum array);
|
|
||||||
void glDisableClientState(GLenum array);
|
|
||||||
void glArrayElement(GLint i);
|
|
||||||
void glVertexPointer(GLint size, GLenum type, GLsizei stride,
|
|
||||||
const GLvoid *pointer);
|
|
||||||
void glColorPointer(GLint size, GLenum type, GLsizei stride,
|
|
||||||
const GLvoid *pointer);
|
|
||||||
void glNormalPointer(GLenum type, GLsizei stride,
|
|
||||||
const GLvoid *pointer);
|
|
||||||
void glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
|
|
||||||
const GLvoid *pointer);
|
|
||||||
|
|
||||||
/* opengl 1.2 polygon offset */
|
|
||||||
void glPolygonOffset(GLfloat factor, GLfloat units);
|
|
||||||
|
|
||||||
/* not implemented, just added to compile */
|
|
||||||
/*
|
|
||||||
inline void glPointSize(float) {}
|
|
||||||
inline void glLineWidth(float) {}
|
|
||||||
inline void glDeleteLists(int, int) {}
|
|
||||||
inline void glDepthFunc(int) {}
|
|
||||||
inline void glBlendFunc(int, int) {}
|
|
||||||
inline void glTexEnvf(int, int, int) {}
|
|
||||||
inline void glOrtho(float,float,float,float,float,float){}
|
|
||||||
inline void glVertex2i(int,int) {}
|
|
||||||
inline void glDepthMask(int) {}
|
|
||||||
inline void glFogi(int, int) {}
|
|
||||||
inline void glFogfv(int, const float*) {}
|
|
||||||
inline void glFogf(int, float) {}
|
|
||||||
inline void glRasterPos2f(float, float) {}
|
|
||||||
inline void glPolygonStipple(void*) {}
|
|
||||||
inline void glTexParameterf(int, int, int) {};
|
|
||||||
*/
|
|
||||||
/* non compatible functions */
|
|
||||||
|
|
||||||
void glDebug(int mode);
|
|
||||||
|
|
||||||
void glInit(void *zbuffer);
|
|
||||||
void glClose(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
#ifndef GLU_H
|
|
||||||
#define GLU_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void gluPerspective( GLdouble fovy, GLdouble aspect,
|
|
||||||
GLdouble zNear, GLdouble zFar );
|
|
||||||
|
|
||||||
void
|
|
||||||
gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez,
|
|
||||||
GLdouble centerx, GLdouble centery, GLdouble centerz,
|
|
||||||
GLdouble upx, GLdouble upy, GLdouble upz);
|
|
||||||
|
|
||||||
|
|
||||||
void drawTorus(float rc, int numc, float rt, int numt);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int draw_style;
|
|
||||||
} GLUquadricObj;
|
|
||||||
|
|
||||||
#define GLU_LINE 0
|
|
||||||
|
|
||||||
GLUquadricObj* gluNewQuadric(void);
|
|
||||||
void gluQuadricDrawStyle(GLUquadricObj *obj, int style);
|
|
||||||
|
|
||||||
void gluSphere(GLUquadricObj *qobj,
|
|
||||||
float radius,int slices,int stacks);
|
|
||||||
void gluCylinder( GLUquadricObj *qobj,
|
|
||||||
GLdouble baseRadius, GLdouble topRadius, GLdouble height,
|
|
||||||
GLint slices, GLint stacks );
|
|
||||||
void gluDisk( GLUquadricObj *qobj,
|
|
||||||
GLdouble innerRadius, GLdouble outerRadius,
|
|
||||||
GLint slices, GLint loops );
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
@ -1,28 +0,0 @@
|
|||||||
#ifndef KOSGL_H
|
|
||||||
#define KOSGL_H
|
|
||||||
|
|
||||||
#include "gl.h"
|
|
||||||
#include "glu.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef void *KOSGLContext;
|
|
||||||
|
|
||||||
extern KOSGLContext kosglCreateContext( KOSGLContext shareList, int flags );
|
|
||||||
|
|
||||||
extern void kosglDestroyContext( KOSGLContext ctx1 );
|
|
||||||
|
|
||||||
extern int kosglMakeCurrent( int win_x0, int win_y0,
|
|
||||||
int win_x, int win_y,
|
|
||||||
KOSGLContext ctx);
|
|
||||||
|
|
||||||
extern void kosglSwapBuffers();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
|
||||||
* This file is part of the w64 mingw-runtime package.
|
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
|
||||||
*/
|
|
||||||
#ifndef _VARARGS_H
|
|
||||||
#define _VARARGS_H
|
|
||||||
|
|
||||||
#error "TinyCC no longer implements <varargs.h>."
|
|
||||||
#error "Revise your code to use <stdarg.h>."
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,124 +0,0 @@
|
|||||||
format ELF
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
include '../proc32.inc'
|
|
||||||
public _ksys_get_filesize
|
|
||||||
public _ksys_readfile
|
|
||||||
public _ksys_rewritefile
|
|
||||||
public _ksys_appendtofile
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_get_filesize stdcall, filename:dword
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov ebx,[filename]
|
|
||||||
mov [fileinfo.subproc],dword 5
|
|
||||||
mov [fileinfo.offset_l],eax
|
|
||||||
mov [fileinfo.offset_h],eax
|
|
||||||
mov [fileinfo.size],eax
|
|
||||||
mov [fileinfo.data],dword buffer_for_info
|
|
||||||
mov [fileinfo.letter],al
|
|
||||||
mov [fileinfo.filename],ebx
|
|
||||||
|
|
||||||
mov eax,70
|
|
||||||
mov ebx,fileinfo
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
test eax,eax
|
|
||||||
jnz error_for_file_size
|
|
||||||
|
|
||||||
mov eax,[buffer_for_info+32] ;file size
|
|
||||||
ret
|
|
||||||
|
|
||||||
error_for_file_size:
|
|
||||||
neg eax
|
|
||||||
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_readfile stdcall,filename:dword,position:dword,sizeblock:dword,buffer:dword, preadbytes:dword
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov ebx,[position]
|
|
||||||
mov ecx,[sizeblock]
|
|
||||||
mov edx,[buffer]
|
|
||||||
mov esi,[filename]
|
|
||||||
mov [fileinfo.subproc],eax
|
|
||||||
mov [fileinfo.offset_l],ebx
|
|
||||||
mov [fileinfo.offset_h],eax
|
|
||||||
mov [fileinfo.size],ecx
|
|
||||||
mov [fileinfo.data],edx
|
|
||||||
mov [fileinfo.letter],al
|
|
||||||
mov [fileinfo.filename],esi
|
|
||||||
|
|
||||||
mov eax,70
|
|
||||||
mov ebx,fileinfo
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
mov esi, [preadbytes]
|
|
||||||
mov [esi], ebx
|
|
||||||
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_rewritefile stdcall,filename:dword,sizeblock:dword,data_write:dword
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov ebx,[sizeblock]
|
|
||||||
mov ecx,[data_write]
|
|
||||||
mov edx,[filename]
|
|
||||||
mov [fileinfo.subproc],dword 2
|
|
||||||
mov [fileinfo.offset_l],eax
|
|
||||||
mov [fileinfo.offset_h],eax
|
|
||||||
mov [fileinfo.size],ebx
|
|
||||||
mov [fileinfo.data],ecx
|
|
||||||
mov [fileinfo.letter],al
|
|
||||||
mov [fileinfo.filename],edx
|
|
||||||
|
|
||||||
mov eax,70
|
|
||||||
mov ebx,fileinfo
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_appendtofile stdcall,filename:dword,pos:dword,sizeblock:dword,data_append:dword
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov ebx,[pos]
|
|
||||||
mov ecx,[sizeblock]
|
|
||||||
mov edx,[data_append]
|
|
||||||
mov esi,[filename]
|
|
||||||
mov [fileinfo.subproc],dword 3
|
|
||||||
mov [fileinfo.offset_l],ebx
|
|
||||||
mov [fileinfo.offset_h],eax
|
|
||||||
mov [fileinfo.size],ecx
|
|
||||||
mov [fileinfo.data],edx
|
|
||||||
mov [fileinfo.letter],al
|
|
||||||
mov [fileinfo.filename],esi
|
|
||||||
|
|
||||||
mov eax,70
|
|
||||||
mov ebx,fileinfo
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
struc FILEIO
|
|
||||||
{
|
|
||||||
.subproc rd 1
|
|
||||||
.offset_l rd 1
|
|
||||||
.offset_h rd 1
|
|
||||||
.size rd 1
|
|
||||||
.data rd 1
|
|
||||||
.letter rb 1
|
|
||||||
.filename rd 1
|
|
||||||
}
|
|
||||||
|
|
||||||
fileinfo FILEIO
|
|
||||||
buffer_for_info rd 11
|
|
@ -1,54 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_set_background_size,8
|
|
||||||
;arg1 - xsize
|
|
||||||
;arg2 - ysize
|
|
||||||
push ebx
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov edx,[esp+12]
|
|
||||||
mov eax,15
|
|
||||||
mov ebx,1
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 8
|
|
||||||
public_stdcall _ksys_write_background_mem,8
|
|
||||||
;arg1 - pos
|
|
||||||
;arg2 - color
|
|
||||||
push ebx
|
|
||||||
mov eax,15
|
|
||||||
mov ebx,2
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov edx,[esp+12]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 8
|
|
||||||
public_stdcall _ksys_draw_background,0
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,15
|
|
||||||
mov ebx,3
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
public_stdcall _ksys_set_background_draw_type,4
|
|
||||||
;arg1 - type
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,15
|
|
||||||
mov ebx,4
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
||||||
public_stdcall _ksys_background_blockmove,12
|
|
||||||
;arg1 - source
|
|
||||||
;arg2 - position in dest
|
|
||||||
;arg3 - size
|
|
||||||
push ebx esi
|
|
||||||
mov eax,15
|
|
||||||
mov ebx,5
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
mov edx,[esp+16]
|
|
||||||
mov esi,[esp+20]
|
|
||||||
int 0x40
|
|
||||||
pop esi ebx
|
|
||||||
ret 12
|
|
@ -1,35 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_make_button,24
|
|
||||||
;arg1 - x
|
|
||||||
;arg2 - y
|
|
||||||
;arg3 - xsize
|
|
||||||
;arg4 - ysize
|
|
||||||
;arg5 - id
|
|
||||||
;arg6 - color
|
|
||||||
push ebx esi
|
|
||||||
mov ebx,[esp+12]
|
|
||||||
shl ebx,16
|
|
||||||
mov bx,[esp+20]
|
|
||||||
mov ecx,[esp+16]
|
|
||||||
shl ecx,16
|
|
||||||
mov cx,[esp+24]
|
|
||||||
mov edx,[esp+28]
|
|
||||||
mov esi,[esp+32]
|
|
||||||
mov eax,8
|
|
||||||
int 0x40
|
|
||||||
pop esi ebx
|
|
||||||
ret 24
|
|
||||||
|
|
||||||
public_stdcall _ksys_get_button_id,0
|
|
||||||
mov eax,17
|
|
||||||
int 0x40
|
|
||||||
test al,al
|
|
||||||
jnz .no_button
|
|
||||||
shr eax,8
|
|
||||||
ret
|
|
||||||
.no_button:
|
|
||||||
xor eax,eax
|
|
||||||
dec eax
|
|
||||||
ret
|
|
@ -1,15 +0,0 @@
|
|||||||
format ELF
|
|
||||||
|
|
||||||
include "../proc32.inc"
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
public _ksys_get_system_clock
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_get_system_clock stdcall
|
|
||||||
|
|
||||||
mov eax,3
|
|
||||||
int 0x40
|
|
||||||
ret
|
|
||||||
|
|
||||||
endp
|
|
@ -1,76 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public _ksys_cofflib_load
|
|
||||||
public _ksys_cofflib_getproc
|
|
||||||
|
|
||||||
proc _ksys_cofflib_load stdcall, name:dword
|
|
||||||
|
|
||||||
mov eax, 68
|
|
||||||
mov ebx, 19
|
|
||||||
mov ecx, [name]
|
|
||||||
int 0x40
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
proc _ksys_cofflib_getproc stdcall, export:dword,name:dword
|
|
||||||
|
|
||||||
mov ebx,[export]
|
|
||||||
|
|
||||||
next_name_check:
|
|
||||||
|
|
||||||
mov ecx,[ebx]
|
|
||||||
test ecx,ecx
|
|
||||||
jz end_export
|
|
||||||
|
|
||||||
;cmp export string with name
|
|
||||||
mov esi,[name]
|
|
||||||
xor edi,edi
|
|
||||||
next_simbol_check:
|
|
||||||
|
|
||||||
xor eax,eax
|
|
||||||
mov al,[ecx]
|
|
||||||
; siemargl moved to post-check
|
|
||||||
; test al,al
|
|
||||||
; jz exit_check_simbol
|
|
||||||
|
|
||||||
xor edx,edx
|
|
||||||
mov dl,[esi]
|
|
||||||
cmp al,dl
|
|
||||||
je simbols_equvalent
|
|
||||||
add edi,1
|
|
||||||
jmp exit_check_simbol
|
|
||||||
simbols_equvalent:
|
|
||||||
test al,al
|
|
||||||
jz exit_check_simbol
|
|
||||||
|
|
||||||
;pushad
|
|
||||||
|
|
||||||
;mov cl,al
|
|
||||||
;mov ebx,1
|
|
||||||
;mov eax,63
|
|
||||||
;int 0x40
|
|
||||||
|
|
||||||
;popad
|
|
||||||
|
|
||||||
add ecx,1
|
|
||||||
add esi,1
|
|
||||||
jmp next_simbol_check
|
|
||||||
exit_check_simbol:
|
|
||||||
|
|
||||||
test edi,edi
|
|
||||||
jnz function_not_finded
|
|
||||||
mov eax,[ebx+4]
|
|
||||||
jmp end_export
|
|
||||||
function_not_finded:
|
|
||||||
|
|
||||||
add ebx,8
|
|
||||||
|
|
||||||
jmp next_name_check
|
|
||||||
|
|
||||||
end_export:
|
|
||||||
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_get_date,0
|
|
||||||
mov eax,29
|
|
||||||
int 0x40
|
|
||||||
ret
|
|
@ -1,56 +0,0 @@
|
|||||||
format ELF
|
|
||||||
|
|
||||||
include "../proc32.inc"
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public _ksys_debug_out
|
|
||||||
public debug_out_str
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_debug_out stdcall, c:dword
|
|
||||||
|
|
||||||
pushad
|
|
||||||
|
|
||||||
xor ecx,ecx
|
|
||||||
mov cl,byte[c]
|
|
||||||
mov ebx,1
|
|
||||||
mov eax,63
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
popad
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
endp
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc debug_out_str stdcall, s:dword
|
|
||||||
|
|
||||||
pushad
|
|
||||||
|
|
||||||
mov eax,[s] ;eax=pointer to string
|
|
||||||
next_simbol_print:
|
|
||||||
|
|
||||||
xor ebx,ebx
|
|
||||||
mov bl,[eax]
|
|
||||||
test bl,bl
|
|
||||||
jz exit_print_str
|
|
||||||
|
|
||||||
cmp bl,10
|
|
||||||
jne no_new_line
|
|
||||||
mov ecx,13
|
|
||||||
stdcall _ksys_debug_out, ecx
|
|
||||||
no_new_line:
|
|
||||||
|
|
||||||
stdcall _ksys_debug_out, ebx
|
|
||||||
add eax,1
|
|
||||||
|
|
||||||
jmp next_simbol_print
|
|
||||||
|
|
||||||
exit_print_str:
|
|
||||||
|
|
||||||
popad
|
|
||||||
|
|
||||||
ret
|
|
||||||
endp
|
|
@ -1,11 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_delay,4
|
|
||||||
;arg1 - time
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,5
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
@ -1,34 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_dga_get_resolution,16
|
|
||||||
;arg1 - *xres
|
|
||||||
;arg2 - *yres
|
|
||||||
;arg3 - *bpp
|
|
||||||
;arg4 - *bpscan
|
|
||||||
mov edx,ebx
|
|
||||||
|
|
||||||
mov eax,61
|
|
||||||
mov ebx,1
|
|
||||||
int 0x40
|
|
||||||
mov ebx,[esp+8]
|
|
||||||
mov [ebx],ax
|
|
||||||
mov word [ebx+2],0
|
|
||||||
shr eax,16
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
mov [ebx],eax
|
|
||||||
|
|
||||||
mov eax,61
|
|
||||||
mov ebx,2
|
|
||||||
int 0x40
|
|
||||||
mov ebx,[esp+12]
|
|
||||||
mov [ebx],eax
|
|
||||||
|
|
||||||
mov eax,61
|
|
||||||
mov ebx,3
|
|
||||||
int 0x40
|
|
||||||
mov ebx,[esp+16]
|
|
||||||
mov [ebx],eax
|
|
||||||
|
|
||||||
mov ebx,edx
|
|
||||||
ret 16
|
|
@ -1,21 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_draw_bar,20
|
|
||||||
;arg1 - x
|
|
||||||
;arg2 - y
|
|
||||||
;arg3 - xsize
|
|
||||||
;arg4 - ysize
|
|
||||||
;arg5 - color
|
|
||||||
push ebx
|
|
||||||
mov eax,13
|
|
||||||
mov ebx,[esp+8]
|
|
||||||
shl ebx,16
|
|
||||||
mov bx,[esp+16]
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
shl ecx,16
|
|
||||||
mov cx,[esp+20]
|
|
||||||
mov edx,[esp+24]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 20
|
|
@ -1,21 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_putimage,20
|
|
||||||
;arg1 - x
|
|
||||||
;arg2 - y
|
|
||||||
;arg3 - xsize
|
|
||||||
;arg4 - ysize
|
|
||||||
;arg5 - image
|
|
||||||
push ebx
|
|
||||||
mov ebx,[esp+24]
|
|
||||||
mov ecx,[esp+16]
|
|
||||||
shl ecx,16
|
|
||||||
mov ecx,[esp+20]
|
|
||||||
mov ebx,[esp+8]
|
|
||||||
shl ebx,16
|
|
||||||
mov ebx,[esp+12]
|
|
||||||
mov eax,7
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 20
|
|
@ -1,34 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_draw_window,36
|
|
||||||
;arg1 - xcoord
|
|
||||||
;arg2 - ycoord
|
|
||||||
;arg3 - xsize
|
|
||||||
;arg4 - ysize
|
|
||||||
;arg5 - workcolor
|
|
||||||
;arg6 - type
|
|
||||||
;arg7 - captioncolor
|
|
||||||
;arg8 - windowtype
|
|
||||||
;arg9 - bordercolor
|
|
||||||
push ebp
|
|
||||||
mov ebp,esp
|
|
||||||
push ebx esi edi
|
|
||||||
mov ebx,[ebp+8]
|
|
||||||
shl ebx,16
|
|
||||||
mov bx,[ebp+16]
|
|
||||||
mov ecx,[ebp+12]
|
|
||||||
shl ecx,16
|
|
||||||
mov cx,[ebp+20]
|
|
||||||
mov edx,[ebp+28]
|
|
||||||
shl edx,24
|
|
||||||
add edx,[ebp+24]
|
|
||||||
mov esi,[ebp+36]
|
|
||||||
shl esi,24
|
|
||||||
add esi,[ebp+32]
|
|
||||||
mov edi,[ebp+40]
|
|
||||||
xor eax,eax
|
|
||||||
int 0x40
|
|
||||||
pop edi esi ebx
|
|
||||||
pop ebp
|
|
||||||
ret 36
|
|
@ -1,40 +0,0 @@
|
|||||||
format ELF
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public _ksys_wait_for_event_infinite
|
|
||||||
public _ksys_check_for_event
|
|
||||||
public _ksys_wait_for_event
|
|
||||||
public _ksys_set_wanted_events
|
|
||||||
|
|
||||||
_ksys_wait_for_event_infinite:
|
|
||||||
|
|
||||||
mov eax,10
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
_ksys_check_for_event:
|
|
||||||
|
|
||||||
mov eax,11
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
_ksys_wait_for_event:
|
|
||||||
|
|
||||||
;arg1 - time
|
|
||||||
mov eax,23
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
_ksys_set_wanted_events:
|
|
||||||
|
|
||||||
;arg1 - flags
|
|
||||||
mov eax,40
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret 4
|
|
@ -1,8 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_exit,0
|
|
||||||
xor eax,eax
|
|
||||||
dec eax
|
|
||||||
int 0x40
|
|
||||||
; ret
|
|
@ -1,28 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_send_message,12
|
|
||||||
;arg1 - pid
|
|
||||||
;arg2 - msg
|
|
||||||
;arg3 - size
|
|
||||||
push ebx esi
|
|
||||||
mov eax,60
|
|
||||||
mov ebx,2
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
mov edx,[esp+16]
|
|
||||||
mov esi,[esp+20]
|
|
||||||
int 0x40
|
|
||||||
pop esi ebx
|
|
||||||
ret 12
|
|
||||||
|
|
||||||
public_stdcall _ksys_define_receive_area,8
|
|
||||||
;arg1 - area
|
|
||||||
;arg2 - size
|
|
||||||
push ebx
|
|
||||||
mov eax,60
|
|
||||||
mov ebx,1
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov edx,[esp+12]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 8
|
|
@ -1,119 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_get_irq_owner,4
|
|
||||||
;arg1 - irq
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,41
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
public_stdcall _ksys_get_data_read_by_irq,12
|
|
||||||
;arg1 - irq
|
|
||||||
;arg2 - *size
|
|
||||||
;arg3 - data
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,42
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
cmp ecx,2
|
|
||||||
jz .not_an_owner
|
|
||||||
push ecx
|
|
||||||
mov ecx,[esp+16]
|
|
||||||
test ecx,ecx
|
|
||||||
jz .ignore_data
|
|
||||||
mov [ecx],bl
|
|
||||||
.ignore_data:
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
mov [ecx],eax
|
|
||||||
pop eax
|
|
||||||
mov ebx,edx
|
|
||||||
ret 12
|
|
||||||
.not_an_owner:
|
|
||||||
mov eax,2
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
|
|
||||||
public_stdcall _ksys_send_data_to_device,8
|
|
||||||
;arg1 - port
|
|
||||||
;arg2 - data
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,63
|
|
||||||
mov ebx,[esp+8]
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 8
|
|
||||||
|
|
||||||
public_stdcall _ksys_receive_data_from_device,8
|
|
||||||
;arg1 - port
|
|
||||||
;arg2 - data
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,43
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
add ecx,0x80000000
|
|
||||||
int 0x40
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov [ecx],bl
|
|
||||||
mov ebx,edx
|
|
||||||
ret 8
|
|
||||||
|
|
||||||
public_stdcall _ksys_program_irq,8
|
|
||||||
;arg1 - intrtable
|
|
||||||
;arg2 - irq
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,44
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 8
|
|
||||||
|
|
||||||
public_stdcall _ksys_reserve_irq,4
|
|
||||||
;arg1 - irq
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,45
|
|
||||||
xor ebx,ebx
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
public_stdcall _ksys_free_irq,4
|
|
||||||
;arg1 - irq
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,45
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
public_stdcall _ksys_reserve_port_area,8
|
|
||||||
;arg1 - start
|
|
||||||
;arg2 - end
|
|
||||||
push ebx
|
|
||||||
mov eax,46
|
|
||||||
xor ebx,ebx
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov edx,[esp+12]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 8
|
|
||||||
|
|
||||||
public_stdcall _ksys_free_port_area,8
|
|
||||||
;arg1 - start
|
|
||||||
;arg2 - end
|
|
||||||
push ebx
|
|
||||||
mov eax,46
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov edx,[esp+12]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 8
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
format ELF
|
|
||||||
|
|
||||||
include "../proc32.inc"
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public _ksys_get_key
|
|
||||||
public _ksys_set_keyboard_mode
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_get_key stdcall
|
|
||||||
|
|
||||||
mov eax,2
|
|
||||||
int 0x40
|
|
||||||
ret
|
|
||||||
|
|
||||||
endp
|
|
||||||
|
|
||||||
align 4
|
|
||||||
proc _ksys_set_keyboard_mode stdcall, mode:dword
|
|
||||||
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,66
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
mov ecx,[mode]
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
endp
|
|
@ -1,21 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_line,20
|
|
||||||
;arg1 - x1
|
|
||||||
;arg2 - y1
|
|
||||||
;arg3 - x2
|
|
||||||
;arg4 - y2
|
|
||||||
;arg5 - color
|
|
||||||
push ebx
|
|
||||||
mov ebx,[esp+8]
|
|
||||||
shl ebx,16
|
|
||||||
mov bx,[esp+16]
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
shl ecx,16
|
|
||||||
mov cx,[esp+20]
|
|
||||||
mov edx,[esp+24]
|
|
||||||
mov eax,38
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 20
|
|
@ -1,21 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_midi_reset,0
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,20
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
|
|
||||||
public_stdcall _ksys_midi_send,4
|
|
||||||
;arg1 - data
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,20
|
|
||||||
mov ebx,2
|
|
||||||
xor ecx,ecx
|
|
||||||
mov cl,[esp+4]
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public _ksys_GetMouseXY
|
|
||||||
public _ksys_GetMouseButtonsState
|
|
||||||
|
|
||||||
align 4
|
|
||||||
_ksys_GetMouseXY:
|
|
||||||
|
|
||||||
mov eax,37
|
|
||||||
mov ebx,1
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
align 4
|
|
||||||
_ksys_GetMouseButtonsState:
|
|
||||||
|
|
||||||
mov eax,37
|
|
||||||
mov ebx,2
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret
|
|
@ -1,138 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_get_pci_version,0
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,62
|
|
||||||
xor ebx,ebx
|
|
||||||
int 0x40
|
|
||||||
movzx eax,ax
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
|
|
||||||
public_stdcall _ksys_get_last_pci_bus,0
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,62
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
int 0x40
|
|
||||||
movzx eax,al
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
|
|
||||||
public_stdcall _ksys_get_pci_access_mechanism,0
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,62
|
|
||||||
mov ebx,2
|
|
||||||
int 0x40
|
|
||||||
movzx eax,al
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
|
|
||||||
public_stdcall _ksys_pci_read_config_byte,16
|
|
||||||
;arg1 - bus
|
|
||||||
;arg2 - dev
|
|
||||||
;arg3 - fn
|
|
||||||
;arg4 - reg
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,62
|
|
||||||
mov bl,4
|
|
||||||
mov bh,[esp+4]
|
|
||||||
mov ch,[esp+8]
|
|
||||||
shl ch,3
|
|
||||||
add ch,[esp+12]
|
|
||||||
mov cl,[esp+16]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 16
|
|
||||||
|
|
||||||
public_stdcall _ksys_pci_read_config_word,16
|
|
||||||
;arg1 - bus
|
|
||||||
;arg2 - dev
|
|
||||||
;arg3 - fn
|
|
||||||
;arg4 - reg
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,62
|
|
||||||
mov bl,5
|
|
||||||
mov bh,[esp+4]
|
|
||||||
mov ch,[esp+8]
|
|
||||||
shl ch,3
|
|
||||||
add ch,[esp+12]
|
|
||||||
mov cl,[esp+16]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 16
|
|
||||||
|
|
||||||
public_stdcall _ksys_pci_read_config_dword,16
|
|
||||||
;arg1 - bus
|
|
||||||
;arg2 - dev
|
|
||||||
;arg3 - fn
|
|
||||||
;arg4 - reg
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,62
|
|
||||||
mov bl,6
|
|
||||||
mov bh,[esp+4]
|
|
||||||
mov ch,[esp+8]
|
|
||||||
shl ch,3
|
|
||||||
add ch,[esp+12]
|
|
||||||
mov cl,[esp+16]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 16
|
|
||||||
|
|
||||||
public_stdcall _ksys_pci_write_config_byte,20
|
|
||||||
;arg1 - bus
|
|
||||||
;arg2 - dev
|
|
||||||
;arg3 - fn
|
|
||||||
;arg4 - reg
|
|
||||||
;arg5 - value
|
|
||||||
push ebx
|
|
||||||
mov eax,62
|
|
||||||
mov bl,8
|
|
||||||
mov bh,[esp+8]
|
|
||||||
mov ch,[esp+12]
|
|
||||||
shl ch,3
|
|
||||||
mov ch,[esp+16]
|
|
||||||
mov cl,[esp+20]
|
|
||||||
movzx edx,byte [esp+24]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 20
|
|
||||||
|
|
||||||
public_stdcall _ksys_pci_write_config_word,20
|
|
||||||
;arg1 - bus
|
|
||||||
;arg2 - dev
|
|
||||||
;arg3 - fn
|
|
||||||
;arg4 - reg
|
|
||||||
;arg5 - value
|
|
||||||
push ebx
|
|
||||||
mov eax,62
|
|
||||||
mov bl,9
|
|
||||||
mov bh,[esp+8]
|
|
||||||
mov ch,[esp+12]
|
|
||||||
shl ch,3
|
|
||||||
mov ch,[esp+16]
|
|
||||||
mov cl,[esp+20]
|
|
||||||
movzx edx,word [esp+24]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 20
|
|
||||||
|
|
||||||
public_stdcall _ksys_pci_write_config_dword,20
|
|
||||||
;arg1 - bus
|
|
||||||
;arg2 - dev
|
|
||||||
;arg3 - fn
|
|
||||||
;arg4 - reg
|
|
||||||
;arg5 - value
|
|
||||||
push ebx
|
|
||||||
mov eax,62
|
|
||||||
mov bl,10
|
|
||||||
mov bh,[esp+8]
|
|
||||||
mov ch,[esp+12]
|
|
||||||
shl ch,3
|
|
||||||
mov ch,[esp+16]
|
|
||||||
mov cl,[esp+20]
|
|
||||||
mov edx,[esp+24]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 20
|
|
@ -1,16 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_putpixel,12
|
|
||||||
;arg1 - x
|
|
||||||
;arg2 - y
|
|
||||||
;arg3 - color
|
|
||||||
push ebx
|
|
||||||
xor eax,eax
|
|
||||||
mov ebx,[esp+8]
|
|
||||||
inc eax
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
mov edx,[esp+16]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 12
|
|
@ -1,24 +0,0 @@
|
|||||||
format ELF
|
|
||||||
;include "public_stdcall.inc"
|
|
||||||
|
|
||||||
public _ksys_get_process_table
|
|
||||||
public _ksys_kill_process
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
_ksys_get_process_table:
|
|
||||||
;arg1 - pointer to information
|
|
||||||
;arg2 - pid
|
|
||||||
mov eax,9
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
int 0x40
|
|
||||||
ret 8
|
|
||||||
|
|
||||||
_ksys_kill_process:
|
|
||||||
;arg - pid
|
|
||||||
mov eax, 18
|
|
||||||
mov ebx, 18
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
ret 4
|
|
@ -1,15 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_get_screen_size,8
|
|
||||||
;arg1 - x
|
|
||||||
;arg2 - y
|
|
||||||
mov eax,14
|
|
||||||
int 0x40
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov [ecx],ax
|
|
||||||
mov word [ecx+2],0
|
|
||||||
shr eax,16
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
mov [ecx],eax
|
|
||||||
ret 8
|
|
@ -1,13 +0,0 @@
|
|||||||
format ELF
|
|
||||||
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public _ksys_get_skin_height
|
|
||||||
|
|
||||||
_ksys_get_skin_height:
|
|
||||||
|
|
||||||
mov eax,48
|
|
||||||
mov ebx,4
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret
|
|
@ -1,65 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_sound_load_block,4
|
|
||||||
;arg1 - blockptr
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,55
|
|
||||||
xor ebx,ebx
|
|
||||||
mov ecx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
public_stdcall _ksys_sound_play_block,0
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,55
|
|
||||||
xor ebx,ebx
|
|
||||||
inc ebx
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret
|
|
||||||
|
|
||||||
public_stdcall _ksys_sound_set_channels,4
|
|
||||||
;arg1 - channels
|
|
||||||
push ebx
|
|
||||||
mov eax,55
|
|
||||||
mov ebx,2
|
|
||||||
xor ecx,ecx
|
|
||||||
mov edx,[esp+8]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
public_stdcall _ksys_sound_set_data_size,4
|
|
||||||
;arg1 - data size
|
|
||||||
push ebx
|
|
||||||
mov eax,55
|
|
||||||
mov ebx,2
|
|
||||||
xor ecx,ecx
|
|
||||||
inc ecx
|
|
||||||
mov edx,[esp+8]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
public_stdcall _ksys_sound_set_frequency,4
|
|
||||||
;arg1 - frequency
|
|
||||||
push ebx
|
|
||||||
mov eax,55
|
|
||||||
mov ebx,2
|
|
||||||
mov ecx,2
|
|
||||||
mov edx,[esp+8]
|
|
||||||
int 0x40
|
|
||||||
pop ebx
|
|
||||||
ret 4
|
|
||||||
|
|
||||||
public_stdcall _ksys_sound_speaker_play,4
|
|
||||||
;arg1 - data
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,55
|
|
||||||
mov ebx,55
|
|
||||||
mov esi,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
@ -1,33 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
extrn sysmalloc
|
|
||||||
public_stdcall _ksys_start_thread,12
|
|
||||||
;arg1 - proc
|
|
||||||
;arg2 - stacksize
|
|
||||||
;arg3 - pid
|
|
||||||
push dword [esp+8]
|
|
||||||
call sysmalloc
|
|
||||||
test eax,eax
|
|
||||||
jz .no_mem
|
|
||||||
push ebx
|
|
||||||
mov edx,eax
|
|
||||||
add edx,[esp+12]
|
|
||||||
mov [edx-4],dword 0
|
|
||||||
mov ecx,[esp+8]
|
|
||||||
mov ebx,1
|
|
||||||
mov eax,51
|
|
||||||
int 0x40
|
|
||||||
mov ebx,[esp+16]
|
|
||||||
test ebx,ebx
|
|
||||||
jz .no_val
|
|
||||||
mov [ebx],eax
|
|
||||||
.no_val:
|
|
||||||
mov eax,edx
|
|
||||||
sub eax,[esp+12]
|
|
||||||
pop ebx
|
|
||||||
ret 12
|
|
||||||
.no_mem:
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
mov [ecx],eax
|
|
||||||
ret 12
|
|
@ -1,11 +0,0 @@
|
|||||||
format ELF
|
|
||||||
include "public_stdcall.inc"
|
|
||||||
section '.text' executable
|
|
||||||
public_stdcall _ksys_window_redraw,4
|
|
||||||
;arg1 - status
|
|
||||||
mov edx,ebx
|
|
||||||
mov eax,12
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
int 0x40
|
|
||||||
mov ebx,edx
|
|
||||||
ret 4
|
|
@ -1,21 +0,0 @@
|
|||||||
format ELF
|
|
||||||
section '.text' executable
|
|
||||||
public _ksys_write_text
|
|
||||||
|
|
||||||
_ksys_write_text:
|
|
||||||
;arg1 - x
|
|
||||||
;arg2 - y
|
|
||||||
;arg3 - color
|
|
||||||
;arg4 - text
|
|
||||||
;arg5 - len
|
|
||||||
|
|
||||||
mov eax,4
|
|
||||||
mov ebx,[esp+4]
|
|
||||||
shl ebx,16
|
|
||||||
mov bx,[esp+8]
|
|
||||||
mov ecx,[esp+12]
|
|
||||||
mov edx,[esp+16]
|
|
||||||
mov esi,[esp+20]
|
|
||||||
int 0x40
|
|
||||||
|
|
||||||
ret 20
|
|
@ -1,23 +0,0 @@
|
|||||||
/* Return the name-within-directory of a file name.
|
|
||||||
Copyright (C) 1996-2019 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
char *
|
|
||||||
basename (const char *filename)
|
|
||||||
{
|
|
||||||
char *p = strrchr (filename, '/');
|
|
||||||
return p ? p + 1 : (char *) filename;
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
/* dirname - return directory part of PATH.
|
|
||||||
Copyright (C) 1996-2019 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <libgen.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
char *
|
|
||||||
dirname (char *path)
|
|
||||||
{
|
|
||||||
static const char dot[] = ".";
|
|
||||||
char *last_slash;
|
|
||||||
/* Find last '/'. */
|
|
||||||
last_slash = path != NULL ? strrchr (path, '/') : NULL;
|
|
||||||
if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
|
|
||||||
{
|
|
||||||
/* Determine whether all remaining characters are slashes. */
|
|
||||||
char *runp;
|
|
||||||
for (runp = last_slash; runp != path; --runp)
|
|
||||||
if (runp[-1] != '/')
|
|
||||||
break;
|
|
||||||
/* The '/' is the last character, we have to look further. */
|
|
||||||
if (runp != path)
|
|
||||||
last_slash = memrchr (path, '/', runp - path);
|
|
||||||
}
|
|
||||||
if (last_slash != NULL)
|
|
||||||
{
|
|
||||||
/* Determine whether all remaining characters are slashes. */
|
|
||||||
char *runp;
|
|
||||||
for (runp = last_slash; runp != path; --runp)
|
|
||||||
if (runp[-1] != '/')
|
|
||||||
break;
|
|
||||||
/* Terminate the path. */
|
|
||||||
if (runp == path)
|
|
||||||
{
|
|
||||||
/* The last slash is the first character in the string. We have to
|
|
||||||
return "/". As a special case we have to return "//" if there
|
|
||||||
are exactly two slashes at the beginning of the string. See
|
|
||||||
XBD 4.10 Path Name Resolution for more information. */
|
|
||||||
if (last_slash == path + 1)
|
|
||||||
++last_slash;
|
|
||||||
else
|
|
||||||
last_slash = path + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
last_slash = runp;
|
|
||||||
last_slash[0] = '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
/* This assignment is ill-designed but the XPG specs require to
|
|
||||||
return a string containing "." in any case no directory part is
|
|
||||||
found and so a static and constant string is required. */
|
|
||||||
path = (char *) dot;
|
|
||||||
return path;
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public acos_ as "acos"
|
|
||||||
|
|
||||||
acos_:
|
|
||||||
|
|
||||||
; acos(x) = atan(sqrt((1-x*x)/(x*x)))
|
|
||||||
|
|
||||||
fld qword[esp+4]
|
|
||||||
fld st0 ;Duplicate X on tos.
|
|
||||||
fmul st0, st1 ;Compute X**2.
|
|
||||||
fld st0 ;Duplicate X**2 on tos.
|
|
||||||
fld1 ;Compute 1-X**2.
|
|
||||||
fsub st0, st1
|
|
||||||
fdiv st0, st1 ;Compute (1-x**2)/X**2.
|
|
||||||
fsqrt ;Compute sqrt((1-X**2)/X**2).
|
|
||||||
fld1 ;To compute full arctangent.
|
|
||||||
fpatan ;Compute atan of the above.
|
|
||||||
ret
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <math.h>
|
|
||||||
|
|
||||||
double asin(double x)
|
|
||||||
{
|
|
||||||
return atan(sqrt(x * x / (1.0 - x * x)));
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public atan_ as "atan"
|
|
||||||
|
|
||||||
atan_:
|
|
||||||
|
|
||||||
fld qword[esp+4]
|
|
||||||
fld1
|
|
||||||
fpatan
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public atan2_ as "atan2"
|
|
||||||
|
|
||||||
atan2_:
|
|
||||||
|
|
||||||
fld qword[esp+8]
|
|
||||||
fld qword[esp+4]
|
|
||||||
fpatan
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public ceil
|
|
||||||
|
|
||||||
ceil:
|
|
||||||
|
|
||||||
push ebp
|
|
||||||
mov ebp,esp
|
|
||||||
sub esp,8
|
|
||||||
|
|
||||||
fstcw [ebp-12]
|
|
||||||
mov dx,[ebp-12]
|
|
||||||
or dx,0x0800
|
|
||||||
and dx,0xfbff
|
|
||||||
mov word[ebp-16],dx
|
|
||||||
fldcw [ebp-16]
|
|
||||||
|
|
||||||
fld qword[ebp+8]
|
|
||||||
frndint
|
|
||||||
|
|
||||||
fldcw [ebp-12]
|
|
||||||
|
|
||||||
leave
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public ceilf
|
|
||||||
|
|
||||||
ceilf:
|
|
||||||
|
|
||||||
push ebp
|
|
||||||
mov ebp,esp
|
|
||||||
sub esp,8
|
|
||||||
|
|
||||||
fstcw [ebp-12]
|
|
||||||
mov dx,[ebp-12]
|
|
||||||
or dx,0x0800
|
|
||||||
and dx,0xfbff
|
|
||||||
mov word[ebp-16],dx
|
|
||||||
fldcw [ebp-16]
|
|
||||||
|
|
||||||
fld dword[ebp+8]
|
|
||||||
frndint
|
|
||||||
|
|
||||||
fldcw [ebp-12]
|
|
||||||
|
|
||||||
leave
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public cos_ as "cos"
|
|
||||||
|
|
||||||
cos_:
|
|
||||||
|
|
||||||
fld qword[esp+4]
|
|
||||||
fcos
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <math.h>
|
|
||||||
|
|
||||||
double cosh (double x)
|
|
||||||
{
|
|
||||||
return (exp(x) + exp(-x)) / 2;
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public exp_ as "exp"
|
|
||||||
public exp2_ as "exp2"
|
|
||||||
|
|
||||||
SaveCW dw ?
|
|
||||||
MaskedCW dw ?
|
|
||||||
|
|
||||||
; 2**x = 2**int(x) * 2**frac(x).
|
|
||||||
; We can easily compute 2**int(x) with fscale and
|
|
||||||
; 2**frac(x) using f2xm1.
|
|
||||||
exp2_int:
|
|
||||||
fstcw [SaveCW]
|
|
||||||
|
|
||||||
; Modify the control word to truncate when rounding.
|
|
||||||
|
|
||||||
fstcw [MaskedCW]
|
|
||||||
or byte ptr MaskedCW + 1, 1100b
|
|
||||||
fldcw [MaskedCW]
|
|
||||||
|
|
||||||
fld st0 ;Duplicate tos.
|
|
||||||
fld st0
|
|
||||||
frndint ;Compute integer portion.
|
|
||||||
|
|
||||||
fxch ;Swap whole and int values.
|
|
||||||
fsub st0, st1 ;Compute fractional part.
|
|
||||||
|
|
||||||
f2xm1 ;Compute 2**frac(x)-1.
|
|
||||||
fld1
|
|
||||||
faddp st1, st0 ;Compute 2**frac(x).
|
|
||||||
|
|
||||||
fxch ;Get integer portion.
|
|
||||||
fld1 ;Compute 1*2**int(x).
|
|
||||||
fscale
|
|
||||||
fstp st1 ;Remove st(1) (which is 1).
|
|
||||||
|
|
||||||
fmulp st1, st0 ;Compute 2**int(x) * 2**frac(x).
|
|
||||||
fstp st1 ;Remove st1
|
|
||||||
|
|
||||||
fldcw [SaveCW] ;Restore rounding mode.
|
|
||||||
ret
|
|
||||||
|
|
||||||
exp_:
|
|
||||||
; exp(x) = 2**(x * lg(e))
|
|
||||||
|
|
||||||
fld qword[esp+4]
|
|
||||||
fldl2e ;Put lg(e) onto the stack.
|
|
||||||
fmulp st1, st0 ;Compute x*lg(e).
|
|
||||||
call exp2_int;Compute 2**(x * lg(e))
|
|
||||||
ret
|
|
||||||
|
|
||||||
exp2_:
|
|
||||||
fld qword[esp+4]
|
|
||||||
call exp2_int;Compute 2 ** x
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public fabs_ as "fabs"
|
|
||||||
|
|
||||||
fabs_:
|
|
||||||
|
|
||||||
fld qword[esp+4]
|
|
||||||
fabs
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public fabsf
|
|
||||||
|
|
||||||
fabsf:
|
|
||||||
|
|
||||||
fld dword[esp+4]
|
|
||||||
fabs
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public floor
|
|
||||||
|
|
||||||
floor:
|
|
||||||
|
|
||||||
push ebp
|
|
||||||
mov ebp,esp
|
|
||||||
sub esp,8
|
|
||||||
|
|
||||||
fstcw [ebp-12]
|
|
||||||
mov dx,word[ebp-12]
|
|
||||||
or dx,0x0400
|
|
||||||
and dx,0xf7ff
|
|
||||||
mov word[ebp-16],dx
|
|
||||||
fldcw [ebp-16]
|
|
||||||
|
|
||||||
fld qword[ebp+8]
|
|
||||||
frndint
|
|
||||||
|
|
||||||
fldcw [ebp-12]
|
|
||||||
|
|
||||||
leave
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public floorf
|
|
||||||
|
|
||||||
floorf:
|
|
||||||
|
|
||||||
push ebp
|
|
||||||
mov ebp,esp
|
|
||||||
sub esp,8
|
|
||||||
|
|
||||||
fstcw [ebp-12]
|
|
||||||
mov dx,word[ebp-12]
|
|
||||||
or dx,0x0400
|
|
||||||
and dx,0xf7ff
|
|
||||||
mov word[ebp-16],dx
|
|
||||||
fldcw [ebp-16]
|
|
||||||
|
|
||||||
fld dword[ebp+8]
|
|
||||||
frndint
|
|
||||||
|
|
||||||
fldcw [ebp-12]
|
|
||||||
|
|
||||||
leave
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
|||||||
#include <math.h>
|
|
||||||
|
|
||||||
double remainder(double numer, double denom)
|
|
||||||
{
|
|
||||||
double res;
|
|
||||||
asm("fldl %2;"
|
|
||||||
"fldl %1;"
|
|
||||||
"fprem1;"
|
|
||||||
"fstpl %0;"
|
|
||||||
"fstp %%st;"
|
|
||||||
: "=m"(res)
|
|
||||||
: "m"(numer), "m"(denom)
|
|
||||||
);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
//remainder of 5.3 / 2 is -0.700000
|
|
||||||
//remainder of 18.5 / 4.2 is 1.700000
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double fmod(double numer, double denom)
|
|
||||||
{
|
|
||||||
double res;
|
|
||||||
asm("fldl %2;"
|
|
||||||
"fldl %1;"
|
|
||||||
"fprem;"
|
|
||||||
"fstpl %0;"
|
|
||||||
"fstp %%st;"
|
|
||||||
: "=m"(res)
|
|
||||||
: "m"(numer), "m"(denom)
|
|
||||||
);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
// fmod of 5.3 / 2 is 1.300000
|
|
||||||
// fmod of 18.5 / 4.2 is 1.700000
|
|
||||||
|
|
||||||
|
|
||||||
double modf(double x, double *intpart)
|
|
||||||
{
|
|
||||||
double res, intp;
|
|
||||||
asm("fldl %2;"
|
|
||||||
"fldl %2;"
|
|
||||||
"frndint;"
|
|
||||||
"fstl %1;"
|
|
||||||
"fxch;"
|
|
||||||
"fsubp %%st, %%st(1);"
|
|
||||||
"fstpl %0"
|
|
||||||
: "=m"(res), "=m"(intp)
|
|
||||||
: "m"(x)
|
|
||||||
);
|
|
||||||
*intpart = intp;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
double ldexp (double x, int expon)
|
|
||||||
// = x * 2^expot
|
|
||||||
{
|
|
||||||
double res;
|
|
||||||
asm("fildl %2;"
|
|
||||||
"fldl %1;"
|
|
||||||
"fscale;"
|
|
||||||
"fstpl %0;"
|
|
||||||
"fstp %%st;"
|
|
||||||
: "=m"(res)
|
|
||||||
: "m"(x), "m"(expon)
|
|
||||||
);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
double frexp (double x, int* expon)
|
|
||||||
{
|
|
||||||
double res;
|
|
||||||
asm("fldl %2;"
|
|
||||||
"fxtract;"
|
|
||||||
"fstpl %0;"
|
|
||||||
"fistpl %1;"
|
|
||||||
"fstp %%st;"
|
|
||||||
: "=m"(res), "=m"(*expon)
|
|
||||||
: "m"(x)
|
|
||||||
);
|
|
||||||
|
|
||||||
// *expon = (int)ex;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
// 8.000000 = 0.500000 * 2^ 4
|
|
@ -1,754 +0,0 @@
|
|||||||
/* TCC runtime library.
|
|
||||||
Parts of this code are (c) 2002 Fabrice Bellard
|
|
||||||
|
|
||||||
Copyright (C) 1987, 1988, 1992, 1994, 1995 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
|
||||||
later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU General Public License, the
|
|
||||||
Free Software Foundation gives you unlimited permission to link the
|
|
||||||
compiled version of this file into combinations with other programs,
|
|
||||||
and to distribute those combinations without any restriction coming
|
|
||||||
from the use of this file. (The General Public License restrictions
|
|
||||||
do apply in other respects; for example, they cover modification of
|
|
||||||
the file, and distribution when not linked into a combine
|
|
||||||
executable.)
|
|
||||||
|
|
||||||
This file is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING. If not, write to
|
|
||||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//#include <stdint.h>
|
|
||||||
#define TCC_TARGET_I386
|
|
||||||
|
|
||||||
#define W_TYPE_SIZE 32
|
|
||||||
#define BITS_PER_UNIT 8
|
|
||||||
|
|
||||||
typedef int Wtype;
|
|
||||||
typedef unsigned int UWtype;
|
|
||||||
typedef unsigned int USItype;
|
|
||||||
typedef long long DWtype;
|
|
||||||
typedef unsigned long long UDWtype;
|
|
||||||
|
|
||||||
struct DWstruct {
|
|
||||||
Wtype low, high;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
struct DWstruct s;
|
|
||||||
DWtype ll;
|
|
||||||
} DWunion;
|
|
||||||
|
|
||||||
typedef long double XFtype;
|
|
||||||
#define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
|
|
||||||
#define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
|
|
||||||
|
|
||||||
/* the following deal with IEEE single-precision numbers */
|
|
||||||
#define EXCESS 126
|
|
||||||
#define SIGNBIT 0x80000000
|
|
||||||
#define HIDDEN (1 << 23)
|
|
||||||
#define SIGN(fp) ((fp) & SIGNBIT)
|
|
||||||
#define EXP(fp) (((fp) >> 23) & 0xFF)
|
|
||||||
#define MANT(fp) (((fp) & 0x7FFFFF) | HIDDEN)
|
|
||||||
#define PACK(s,e,m) ((s) | ((e) << 23) | (m))
|
|
||||||
|
|
||||||
/* the following deal with IEEE double-precision numbers */
|
|
||||||
#define EXCESSD 1022
|
|
||||||
#define HIDDEND (1 << 20)
|
|
||||||
#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
|
|
||||||
#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
|
|
||||||
#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
|
|
||||||
(fp.l.lower >> 22))
|
|
||||||
#define HIDDEND_LL ((long long)1 << 52)
|
|
||||||
#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
|
|
||||||
#define PACKD_LL(s,e,m) (((long long)((s)+((e)<<20))<<32)|(m))
|
|
||||||
|
|
||||||
/* the following deal with x86 long double-precision numbers */
|
|
||||||
#define EXCESSLD 16382
|
|
||||||
#define EXPLD(fp) (fp.l.upper & 0x7fff)
|
|
||||||
#define SIGNLD(fp) ((fp.l.upper) & 0x8000)
|
|
||||||
|
|
||||||
/* only for x86 */
|
|
||||||
union ldouble_long {
|
|
||||||
long double ld;
|
|
||||||
struct {
|
|
||||||
unsigned long long lower;
|
|
||||||
unsigned short upper;
|
|
||||||
} l;
|
|
||||||
};
|
|
||||||
|
|
||||||
union double_long {
|
|
||||||
double d;
|
|
||||||
#if 1
|
|
||||||
struct {
|
|
||||||
unsigned int lower;
|
|
||||||
int upper;
|
|
||||||
} l;
|
|
||||||
#else
|
|
||||||
struct {
|
|
||||||
int upper;
|
|
||||||
unsigned int lower;
|
|
||||||
} l;
|
|
||||||
#endif
|
|
||||||
long long ll;
|
|
||||||
};
|
|
||||||
|
|
||||||
union float_long {
|
|
||||||
float f;
|
|
||||||
unsigned int l;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* XXX: we don't support several builtin supports for now */
|
|
||||||
#if !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_ARM)
|
|
||||||
|
|
||||||
/* XXX: use gcc/tcc intrinsic ? */
|
|
||||||
#if defined(TCC_TARGET_I386)
|
|
||||||
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
|
|
||||||
__asm__ ("subl %5,%1\n\tsbbl %3,%0" \
|
|
||||||
: "=r" ((USItype) (sh)), \
|
|
||||||
"=&r" ((USItype) (sl)) \
|
|
||||||
: "0" ((USItype) (ah)), \
|
|
||||||
"g" ((USItype) (bh)), \
|
|
||||||
"1" ((USItype) (al)), \
|
|
||||||
"g" ((USItype) (bl)))
|
|
||||||
#define umul_ppmm(w1, w0, u, v) \
|
|
||||||
__asm__ ("mull %3" \
|
|
||||||
: "=a" ((USItype) (w0)), \
|
|
||||||
"=d" ((USItype) (w1)) \
|
|
||||||
: "%0" ((USItype) (u)), \
|
|
||||||
"rm" ((USItype) (v)))
|
|
||||||
#define udiv_qrnnd(q, r, n1, n0, dv) \
|
|
||||||
__asm__ ("divl %4" \
|
|
||||||
: "=a" ((USItype) (q)), \
|
|
||||||
"=d" ((USItype) (r)) \
|
|
||||||
: "0" ((USItype) (n0)), \
|
|
||||||
"1" ((USItype) (n1)), \
|
|
||||||
"rm" ((USItype) (dv)))
|
|
||||||
#define count_leading_zeros(count, x) \
|
|
||||||
do { \
|
|
||||||
USItype __cbtmp; \
|
|
||||||
__asm__ ("bsrl %1,%0" \
|
|
||||||
: "=r" (__cbtmp) : "rm" ((USItype) (x))); \
|
|
||||||
(count) = __cbtmp ^ 31; \
|
|
||||||
} while (0)
|
|
||||||
#else
|
|
||||||
#error unsupported CPU type
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* most of this code is taken from libgcc2.c from gcc */
|
|
||||||
|
|
||||||
static UDWtype __udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp)
|
|
||||||
{
|
|
||||||
DWunion ww;
|
|
||||||
DWunion nn, dd;
|
|
||||||
DWunion rr;
|
|
||||||
UWtype d0, d1, n0, n1, n2;
|
|
||||||
UWtype q0, q1;
|
|
||||||
UWtype b, bm;
|
|
||||||
|
|
||||||
nn.ll = n;
|
|
||||||
dd.ll = d;
|
|
||||||
|
|
||||||
d0 = dd.s.low;
|
|
||||||
d1 = dd.s.high;
|
|
||||||
n0 = nn.s.low;
|
|
||||||
n1 = nn.s.high;
|
|
||||||
|
|
||||||
#if !defined(UDIV_NEEDS_NORMALIZATION)
|
|
||||||
if (d1 == 0)
|
|
||||||
{
|
|
||||||
if (d0 > n1)
|
|
||||||
{
|
|
||||||
/* 0q = nn / 0D */
|
|
||||||
|
|
||||||
udiv_qrnnd (q0, n0, n1, n0, d0);
|
|
||||||
q1 = 0;
|
|
||||||
|
|
||||||
/* Remainder in n0. */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* qq = NN / 0d */
|
|
||||||
|
|
||||||
if (d0 == 0)
|
|
||||||
d0 = 1 / d0; /* Divide intentionally by zero. */
|
|
||||||
|
|
||||||
udiv_qrnnd (q1, n1, 0, n1, d0);
|
|
||||||
udiv_qrnnd (q0, n0, n1, n0, d0);
|
|
||||||
|
|
||||||
/* Remainder in n0. */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rp != 0)
|
|
||||||
{
|
|
||||||
rr.s.low = n0;
|
|
||||||
rr.s.high = 0;
|
|
||||||
*rp = rr.ll;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* UDIV_NEEDS_NORMALIZATION */
|
|
||||||
|
|
||||||
if (d1 == 0)
|
|
||||||
{
|
|
||||||
if (d0 > n1)
|
|
||||||
{
|
|
||||||
/* 0q = nn / 0D */
|
|
||||||
|
|
||||||
count_leading_zeros (bm, d0);
|
|
||||||
|
|
||||||
if (bm != 0)
|
|
||||||
{
|
|
||||||
/* Normalize, i.e. make the most significant bit of the
|
|
||||||
denominator set. */
|
|
||||||
|
|
||||||
d0 = d0 << bm;
|
|
||||||
n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm));
|
|
||||||
n0 = n0 << bm;
|
|
||||||
}
|
|
||||||
|
|
||||||
udiv_qrnnd (q0, n0, n1, n0, d0);
|
|
||||||
q1 = 0;
|
|
||||||
|
|
||||||
/* Remainder in n0 >> bm. */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* qq = NN / 0d */
|
|
||||||
|
|
||||||
if (d0 == 0)
|
|
||||||
d0 = 1 / d0; /* Divide intentionally by zero. */
|
|
||||||
|
|
||||||
count_leading_zeros (bm, d0);
|
|
||||||
|
|
||||||
if (bm == 0)
|
|
||||||
{
|
|
||||||
/* From (n1 >= d0) /\ (the most significant bit of d0 is set),
|
|
||||||
conclude (the most significant bit of n1 is set) /\ (the
|
|
||||||
leading quotient digit q1 = 1).
|
|
||||||
|
|
||||||
This special case is necessary, not an optimization.
|
|
||||||
(Shifts counts of W_TYPE_SIZE are undefined.) */
|
|
||||||
|
|
||||||
n1 -= d0;
|
|
||||||
q1 = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Normalize. */
|
|
||||||
|
|
||||||
b = W_TYPE_SIZE - bm;
|
|
||||||
|
|
||||||
d0 = d0 << bm;
|
|
||||||
n2 = n1 >> b;
|
|
||||||
n1 = (n1 << bm) | (n0 >> b);
|
|
||||||
n0 = n0 << bm;
|
|
||||||
|
|
||||||
udiv_qrnnd (q1, n1, n2, n1, d0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* n1 != d0... */
|
|
||||||
|
|
||||||
udiv_qrnnd (q0, n0, n1, n0, d0);
|
|
||||||
|
|
||||||
/* Remainder in n0 >> bm. */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rp != 0)
|
|
||||||
{
|
|
||||||
rr.s.low = n0 >> bm;
|
|
||||||
rr.s.high = 0;
|
|
||||||
*rp = rr.ll;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* UDIV_NEEDS_NORMALIZATION */
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (d1 > n1)
|
|
||||||
{
|
|
||||||
/* 00 = nn / DD */
|
|
||||||
|
|
||||||
q0 = 0;
|
|
||||||
q1 = 0;
|
|
||||||
|
|
||||||
/* Remainder in n1n0. */
|
|
||||||
if (rp != 0)
|
|
||||||
{
|
|
||||||
rr.s.low = n0;
|
|
||||||
rr.s.high = n1;
|
|
||||||
*rp = rr.ll;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* 0q = NN / dd */
|
|
||||||
|
|
||||||
count_leading_zeros (bm, d1);
|
|
||||||
if (bm == 0)
|
|
||||||
{
|
|
||||||
/* From (n1 >= d1) /\ (the most significant bit of d1 is set),
|
|
||||||
conclude (the most significant bit of n1 is set) /\ (the
|
|
||||||
quotient digit q0 = 0 or 1).
|
|
||||||
|
|
||||||
This special case is necessary, not an optimization. */
|
|
||||||
|
|
||||||
/* The condition on the next line takes advantage of that
|
|
||||||
n1 >= d1 (true due to program flow). */
|
|
||||||
if (n1 > d1 || n0 >= d0)
|
|
||||||
{
|
|
||||||
q0 = 1;
|
|
||||||
sub_ddmmss (n1, n0, n1, n0, d1, d0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
q0 = 0;
|
|
||||||
|
|
||||||
q1 = 0;
|
|
||||||
|
|
||||||
if (rp != 0)
|
|
||||||
{
|
|
||||||
rr.s.low = n0;
|
|
||||||
rr.s.high = n1;
|
|
||||||
*rp = rr.ll;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UWtype m1, m0;
|
|
||||||
/* Normalize. */
|
|
||||||
|
|
||||||
b = W_TYPE_SIZE - bm;
|
|
||||||
|
|
||||||
d1 = (d1 << bm) | (d0 >> b);
|
|
||||||
d0 = d0 << bm;
|
|
||||||
n2 = n1 >> b;
|
|
||||||
n1 = (n1 << bm) | (n0 >> b);
|
|
||||||
n0 = n0 << bm;
|
|
||||||
|
|
||||||
udiv_qrnnd (q0, n1, n2, n1, d1);
|
|
||||||
umul_ppmm (m1, m0, q0, d0);
|
|
||||||
|
|
||||||
if (m1 > n1 || (m1 == n1 && m0 > n0))
|
|
||||||
{
|
|
||||||
q0--;
|
|
||||||
sub_ddmmss (m1, m0, m1, m0, d1, d0);
|
|
||||||
}
|
|
||||||
|
|
||||||
q1 = 0;
|
|
||||||
|
|
||||||
/* Remainder in (n1n0 - m1m0) >> bm. */
|
|
||||||
if (rp != 0)
|
|
||||||
{
|
|
||||||
sub_ddmmss (n1, n0, n1, n0, m1, m0);
|
|
||||||
rr.s.low = (n1 << b) | (n0 >> bm);
|
|
||||||
rr.s.high = n1 >> bm;
|
|
||||||
*rp = rr.ll;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ww.s.low = q0;
|
|
||||||
ww.s.high = q1;
|
|
||||||
return ww.ll;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define __negdi2(a) (-(a))
|
|
||||||
|
|
||||||
long long __divdi3(long long u, long long v)
|
|
||||||
{
|
|
||||||
int c = 0;
|
|
||||||
DWunion uu, vv;
|
|
||||||
DWtype w;
|
|
||||||
|
|
||||||
uu.ll = u;
|
|
||||||
vv.ll = v;
|
|
||||||
|
|
||||||
if (uu.s.high < 0) {
|
|
||||||
c = ~c;
|
|
||||||
uu.ll = __negdi2 (uu.ll);
|
|
||||||
}
|
|
||||||
if (vv.s.high < 0) {
|
|
||||||
c = ~c;
|
|
||||||
vv.ll = __negdi2 (vv.ll);
|
|
||||||
}
|
|
||||||
w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0);
|
|
||||||
if (c)
|
|
||||||
w = __negdi2 (w);
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
long long __moddi3(long long u, long long v)
|
|
||||||
{
|
|
||||||
int c = 0;
|
|
||||||
DWunion uu, vv;
|
|
||||||
DWtype w;
|
|
||||||
|
|
||||||
uu.ll = u;
|
|
||||||
vv.ll = v;
|
|
||||||
|
|
||||||
if (uu.s.high < 0) {
|
|
||||||
c = ~c;
|
|
||||||
uu.ll = __negdi2 (uu.ll);
|
|
||||||
}
|
|
||||||
if (vv.s.high < 0)
|
|
||||||
vv.ll = __negdi2 (vv.ll);
|
|
||||||
|
|
||||||
__udivmoddi4 (uu.ll, vv.ll, (UDWtype *) &w);
|
|
||||||
if (c)
|
|
||||||
w = __negdi2 (w);
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long long __udivdi3(unsigned long long u, unsigned long long v)
|
|
||||||
{
|
|
||||||
return __udivmoddi4 (u, v, (UDWtype *) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long long __umoddi3(unsigned long long u, unsigned long long v)
|
|
||||||
{
|
|
||||||
UDWtype w;
|
|
||||||
|
|
||||||
__udivmoddi4 (u, v, &w);
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: fix tcc's code generator to do this instead */
|
|
||||||
long long __ashrdi3(long long a, int b)
|
|
||||||
{
|
|
||||||
#ifdef __TINYC__
|
|
||||||
DWunion u;
|
|
||||||
u.ll = a;
|
|
||||||
if (b >= 32) {
|
|
||||||
u.s.low = u.s.high >> (b - 32);
|
|
||||||
u.s.high = u.s.high >> 31;
|
|
||||||
} else if (b != 0) {
|
|
||||||
u.s.low = ((unsigned)u.s.low >> b) | (u.s.high << (32 - b));
|
|
||||||
u.s.high = u.s.high >> b;
|
|
||||||
}
|
|
||||||
return u.ll;
|
|
||||||
#else
|
|
||||||
return a >> b;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: fix tcc's code generator to do this instead */
|
|
||||||
unsigned long long __lshrdi3(unsigned long long a, int b)
|
|
||||||
{
|
|
||||||
#ifdef __TINYC__
|
|
||||||
DWunion u;
|
|
||||||
u.ll = a;
|
|
||||||
if (b >= 32) {
|
|
||||||
u.s.low = (unsigned)u.s.high >> (b - 32);
|
|
||||||
u.s.high = 0;
|
|
||||||
} else if (b != 0) {
|
|
||||||
u.s.low = ((unsigned)u.s.low >> b) | (u.s.high << (32 - b));
|
|
||||||
u.s.high = (unsigned)u.s.high >> b;
|
|
||||||
}
|
|
||||||
return u.ll;
|
|
||||||
#else
|
|
||||||
return a >> b;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: fix tcc's code generator to do this instead */
|
|
||||||
long long __ashldi3(long long a, int b)
|
|
||||||
{
|
|
||||||
#ifdef __TINYC__
|
|
||||||
DWunion u;
|
|
||||||
u.ll = a;
|
|
||||||
if (b >= 32) {
|
|
||||||
u.s.high = (unsigned)u.s.low << (b - 32);
|
|
||||||
u.s.low = 0;
|
|
||||||
} else if (b != 0) {
|
|
||||||
u.s.high = ((unsigned)u.s.high << b) | ((unsigned)u.s.low >> (32 - b));
|
|
||||||
u.s.low = (unsigned)u.s.low << b;
|
|
||||||
}
|
|
||||||
return u.ll;
|
|
||||||
#else
|
|
||||||
return a << b;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef COMMIT_4ad186c5ef61_IS_FIXED
|
|
||||||
long long __tcc_cvt_ftol(long double x)
|
|
||||||
{
|
|
||||||
unsigned c0, c1;
|
|
||||||
long long ret;
|
|
||||||
__asm__ __volatile__ ("fnstcw %0" : "=m" (c0));
|
|
||||||
c1 = c0 | 0x0C00;
|
|
||||||
__asm__ __volatile__ ("fldcw %0" : : "m" (c1));
|
|
||||||
__asm__ __volatile__ ("fistpll %0" : "=m" (ret));
|
|
||||||
__asm__ __volatile__ ("fldcw %0" : : "m" (c0));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !__x86_64__ */
|
|
||||||
|
|
||||||
/* XXX: fix tcc's code generator to do this instead */
|
|
||||||
float __floatundisf(unsigned long long a)
|
|
||||||
{
|
|
||||||
DWunion uu;
|
|
||||||
XFtype r;
|
|
||||||
|
|
||||||
uu.ll = a;
|
|
||||||
if (uu.s.high >= 0) {
|
|
||||||
return (float)uu.ll;
|
|
||||||
} else {
|
|
||||||
r = (XFtype)uu.ll;
|
|
||||||
r += 18446744073709551616.0;
|
|
||||||
return (float)r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double __floatundidf(unsigned long long a)
|
|
||||||
{
|
|
||||||
DWunion uu;
|
|
||||||
XFtype r;
|
|
||||||
|
|
||||||
uu.ll = a;
|
|
||||||
if (uu.s.high >= 0) {
|
|
||||||
return (double)uu.ll;
|
|
||||||
} else {
|
|
||||||
r = (XFtype)uu.ll;
|
|
||||||
r += 18446744073709551616.0;
|
|
||||||
return (double)r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
long double __floatundixf(unsigned long long a)
|
|
||||||
{
|
|
||||||
DWunion uu;
|
|
||||||
XFtype r;
|
|
||||||
|
|
||||||
uu.ll = a;
|
|
||||||
if (uu.s.high >= 0) {
|
|
||||||
return (long double)uu.ll;
|
|
||||||
} else {
|
|
||||||
r = (XFtype)uu.ll;
|
|
||||||
r += 18446744073709551616.0;
|
|
||||||
return (long double)r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long long __fixunssfdi (float a1)
|
|
||||||
{
|
|
||||||
register union float_long fl1;
|
|
||||||
register int exp;
|
|
||||||
register unsigned long l;
|
|
||||||
|
|
||||||
fl1.f = a1;
|
|
||||||
|
|
||||||
if (fl1.l == 0)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
exp = EXP (fl1.l) - EXCESS - 24;
|
|
||||||
|
|
||||||
l = MANT(fl1.l);
|
|
||||||
if (exp >= 41)
|
|
||||||
return (unsigned long long)-1;
|
|
||||||
else if (exp >= 0)
|
|
||||||
return (unsigned long long)l << exp;
|
|
||||||
else if (exp >= -23)
|
|
||||||
return l >> -exp;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long long __fixunsdfdi (double a1)
|
|
||||||
{
|
|
||||||
register union double_long dl1;
|
|
||||||
register int exp;
|
|
||||||
register unsigned long long l;
|
|
||||||
|
|
||||||
dl1.d = a1;
|
|
||||||
|
|
||||||
if (dl1.ll == 0)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
exp = EXPD (dl1) - EXCESSD - 53;
|
|
||||||
|
|
||||||
l = MANTD_LL(dl1);
|
|
||||||
|
|
||||||
if (exp >= 12)
|
|
||||||
return (unsigned long long)-1;
|
|
||||||
else if (exp >= 0)
|
|
||||||
return l << exp;
|
|
||||||
else if (exp >= -52)
|
|
||||||
return l >> -exp;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long long __fixunsxfdi (long double a1)
|
|
||||||
{
|
|
||||||
register union ldouble_long dl1;
|
|
||||||
register int exp;
|
|
||||||
register unsigned long long l;
|
|
||||||
|
|
||||||
dl1.ld = a1;
|
|
||||||
|
|
||||||
if (dl1.l.lower == 0 && dl1.l.upper == 0)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
exp = EXPLD (dl1) - EXCESSLD - 64;
|
|
||||||
|
|
||||||
l = dl1.l.lower;
|
|
||||||
|
|
||||||
if (exp > 0)
|
|
||||||
return (unsigned long long)-1;
|
|
||||||
else if (exp >= -63)
|
|
||||||
return l >> -exp;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
long long __fixsfdi (float a1)
|
|
||||||
{
|
|
||||||
long long ret; int s;
|
|
||||||
ret = __fixunssfdi((s = a1 >= 0) ? a1 : -a1);
|
|
||||||
return s ? ret : -ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
long long __fixdfdi (double a1)
|
|
||||||
{
|
|
||||||
long long ret; int s;
|
|
||||||
ret = __fixunsdfdi((s = a1 >= 0) ? a1 : -a1);
|
|
||||||
return s ? ret : -ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
long long __fixxfdi (long double a1)
|
|
||||||
{
|
|
||||||
long long ret; int s;
|
|
||||||
ret = __fixunsxfdi((s = a1 >= 0) ? a1 : -a1);
|
|
||||||
return s ? ret : -ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(TCC_TARGET_X86_64) && !defined(_WIN64)
|
|
||||||
|
|
||||||
#ifndef __TINYC__
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#else
|
|
||||||
/* Avoid including stdlib.h because it is not easily available when
|
|
||||||
cross compiling */
|
|
||||||
#include <stddef.h> /* size_t definition is needed for a x86_64-tcc to parse memset() */
|
|
||||||
extern void *malloc(unsigned long long);
|
|
||||||
extern void *memset(void *s, int c, size_t n);
|
|
||||||
extern void free(void*);
|
|
||||||
extern void abort(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum __va_arg_type {
|
|
||||||
__va_gen_reg, __va_float_reg, __va_stack
|
|
||||||
};
|
|
||||||
|
|
||||||
//This should be in sync with the declaration on our include/stdarg.h
|
|
||||||
/* 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;
|
|
||||||
|
|
||||||
#undef __va_start
|
|
||||||
#undef __va_arg
|
|
||||||
#undef __va_copy
|
|
||||||
#undef __va_end
|
|
||||||
|
|
||||||
void __va_start(__va_list_struct *ap, void *fp)
|
|
||||||
{
|
|
||||||
memset(ap, 0, sizeof(__va_list_struct));
|
|
||||||
*ap = *(__va_list_struct *)((char *)fp - 16);
|
|
||||||
ap->overflow_arg_area = (char *)fp + ap->overflow_offset;
|
|
||||||
ap->reg_save_area = (char *)fp - 176 - 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *__va_arg(__va_list_struct *ap,
|
|
||||||
enum __va_arg_type arg_type,
|
|
||||||
int size, int align)
|
|
||||||
{
|
|
||||||
size = (size + 7) & ~7;
|
|
||||||
align = (align + 7) & ~7;
|
|
||||||
switch (arg_type) {
|
|
||||||
case __va_gen_reg:
|
|
||||||
if (ap->gp_offset + size <= 48) {
|
|
||||||
ap->gp_offset += size;
|
|
||||||
return ap->reg_save_area + ap->gp_offset - size;
|
|
||||||
}
|
|
||||||
goto use_overflow_area;
|
|
||||||
|
|
||||||
case __va_float_reg:
|
|
||||||
if (ap->fp_offset < 128 + 48) {
|
|
||||||
ap->fp_offset += 16;
|
|
||||||
return ap->reg_save_area + ap->fp_offset - 16;
|
|
||||||
}
|
|
||||||
size = 8;
|
|
||||||
goto use_overflow_area;
|
|
||||||
|
|
||||||
case __va_stack:
|
|
||||||
use_overflow_area:
|
|
||||||
ap->overflow_arg_area += size;
|
|
||||||
ap->overflow_arg_area = (char*)((intptr_t)(ap->overflow_arg_area + align - 1) & -(intptr_t)align);
|
|
||||||
return ap->overflow_arg_area - size;
|
|
||||||
|
|
||||||
default:
|
|
||||||
#ifndef __TINYC__
|
|
||||||
fprintf(stderr, "unknown ABI type for __va_arg\n");
|
|
||||||
#endif
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __x86_64__ */
|
|
||||||
|
|
||||||
/* Flushing for tccrun */
|
|
||||||
#if defined(TCC_TARGET_X86_64) || defined(TCC_TARGET_I386)
|
|
||||||
|
|
||||||
void __clear_cache(void *beginning, void *end)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(TCC_TARGET_ARM)
|
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void __clear_cache(void *beginning, void *end)
|
|
||||||
{
|
|
||||||
/* __ARM_NR_cacheflush is kernel private and should not be used in user space.
|
|
||||||
* However, there is no ARM asm parser in tcc so we use it for now */
|
|
||||||
#if 1
|
|
||||||
syscall(__ARM_NR_cacheflush, beginning, end, 0);
|
|
||||||
#else
|
|
||||||
__asm__ ("push {r7}\n\t"
|
|
||||||
"mov r7, #0xf0002\n\t"
|
|
||||||
"mov r2, #0\n\t"
|
|
||||||
"swi 0\n\t"
|
|
||||||
"pop {r7}\n\t"
|
|
||||||
"ret");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#warning __clear_cache not defined for this architecture, avoid using tcc -run
|
|
||||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public log_ as "log"
|
|
||||||
|
|
||||||
log_:
|
|
||||||
|
|
||||||
; ln(x) = lg(x)/lg(e).
|
|
||||||
|
|
||||||
fld qword[esp+4]
|
|
||||||
fld1
|
|
||||||
fxch
|
|
||||||
fyl2x ;Compute 1*lg(x).
|
|
||||||
fldl2e ;Load lg(e).
|
|
||||||
fdivp st1, st0 ;Compute lg(x)/lg(e).
|
|
||||||
ret
|
|
@ -1,18 +0,0 @@
|
|||||||
|
|
||||||
format ELF
|
|
||||||
include '../proc32.inc'
|
|
||||||
section '.text' executable
|
|
||||||
|
|
||||||
public log10_ as "log10"
|
|
||||||
|
|
||||||
log10_:
|
|
||||||
|
|
||||||
; ln(x) = lg(x)/lg(e).
|
|
||||||
|
|
||||||
fld qword[esp+4]
|
|
||||||
fld1
|
|
||||||
fxch
|
|
||||||
fyl2x ;Compute 1*lg(x).
|
|
||||||
fldl2t ;Load lg(10).
|
|
||||||
fdivp st1, st0 ;Compute lg(x)/lg(10).
|
|
||||||
ret
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <math.h>
|
|
||||||
|
|
||||||
double pow(double x, double y)
|
|
||||||
{
|
|
||||||
return exp(y * log(x));
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user