From 69c1cf47a27e4133513d849fbfe4429dd5d4261b Mon Sep 17 00:00:00 2001 From: Serhii Sakhno Date: Fri, 19 Aug 2016 10:14:48 +0000 Subject: [PATCH] add wrappers for RasterWorks library git-svn-id: svn://kolibrios.org@6494 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/C_Layer/ASM/loadrasterworks.asm | 36 +++++++++++++++++++ contrib/C_Layer/INCLUDE/kolibri_rasterworks.h | 11 ++++++ 2 files changed, 47 insertions(+) create mode 100644 contrib/C_Layer/ASM/loadrasterworks.asm create mode 100644 contrib/C_Layer/INCLUDE/kolibri_rasterworks.h diff --git a/contrib/C_Layer/ASM/loadrasterworks.asm b/contrib/C_Layer/ASM/loadrasterworks.asm new file mode 100644 index 0000000000..18b0da9916 --- /dev/null +++ b/contrib/C_Layer/ASM/loadrasterworks.asm @@ -0,0 +1,36 @@ +format coff +use32 ; Tell compiler to use 32 bit instructions + +section '.flat' code ; Keep this line before includes or GCC messes up call addresses + +;include 'struct.inc' +include '../../../programs/proc32.inc' +include '../../../programs/macros.inc' +purge section,mov,add,sub + +include '../../../programs/dll.inc' + +public init_rasterworks as '_kolibri_rasterworks_init' + +;;; Returns 0 on success. -1 on failure. + +proc init_rasterworks + mcall 68,11 + stdcall dll.Load, @IMPORT + ret +endp + +@IMPORT: + +library lib_rasterworks, 'rasterworks.obj' + +import lib_rasterworks, \ + drawText , 'drawText' , \ + countUTF8Z , 'cntUTF-8' , \ + charsFit , 'charsFit' , \ + strWidth , 'strWidth' + +public drawText as '_drawText' +public countUTF8Z as '_countUTF8Z' +public charsFit as '_charsFit' +public strWidth as '_strWidth' diff --git a/contrib/C_Layer/INCLUDE/kolibri_rasterworks.h b/contrib/C_Layer/INCLUDE/kolibri_rasterworks.h new file mode 100644 index 0000000000..377b0dbb05 --- /dev/null +++ b/contrib/C_Layer/INCLUDE/kolibri_rasterworks.h @@ -0,0 +1,11 @@ +#ifndef KOLIBRI_RASTERWORKS_H +#define KOLIBRI_RASTERWORKS_H + +extern int kolibri_rasterworks_init(void); + +extern void (*drawText)(void *canvas, int x, int y, const char *string, int charQuantity, int fontColor, int params) __attribute__((__stdcall__)); +extern int (*countUTF8Z)(const char *string, int byteQuantity) __attribute__((__stdcall__)); +extern int (*charsFit)(int areaWidth, int charHeight) __attribute__((__stdcall__)); +extern int (*strWidth)(int charQuantity, int charHeight) __attribute__((__stdcall__)); + +#endif /* KOLIBRI_RASTERWORKS_H */