]> git.webhop.me Git - shellexec.git/commitdiff
- introduce current.h to unify console messages and ...
authorsvenhoefer <svenhoefer@svenhoefer.com>
Fri, 23 Sep 2016 06:39:02 +0000 (08:39 +0200)
committersvenhoefer <svenhoefer@svenhoefer.com>
Fri, 23 Sep 2016 06:39:02 +0000 (08:39 +0200)
to simplify includes in gfx, io and text

current.h [new file with mode: 0644]
gfx.c
io.c
shellexec.c
shellexec.h
starter.c
text.c
text.h

diff --git a/current.h b/current.h
new file mode 100644 (file)
index 0000000..aadc827
--- /dev/null
+++ b/current.h
@@ -0,0 +1,3 @@
+#define __plugin__ "shellexec"
+
+#include "shellexec.h"
diff --git a/gfx.c b/gfx.c
index caf0803bd1bfdfa76a508424131cc39daec38afc..50a05397885879ee469569bf2315d1b8537ab5ad 100644 (file)
--- a/gfx.c
+++ b/gfx.c
@@ -1,6 +1,6 @@
 #include <math.h>
 
-#include "shellexec.h"
+#include "current.h"
 #include "gfx.h"
 
 char circle[] =
@@ -40,7 +40,7 @@ void RenderBox(int sx, int sy, int ex, int ey, int rad, int col)
 
        if (dxx<0)
        {
-               printf("[shellexec] RenderBox called with dx < 0 (%d)\n", dxx);
+               printf("[%s] RenderBox called with dx < 0 (%d)\n", __plugin__, dxx);
                dxx=0;
        }
 
@@ -161,7 +161,7 @@ void RenderCircle(int sx, int sy, char col)
 
        if (fd == -1)
        {
-               printf("shellexec <unable to load icon: %s>\n", filename);
+               printf("%s <unable to load icon: %s>\n", __plugin__, filename);
                return;
        }
 
diff --git a/io.c b/io.c
index 2861c833f6732aaf9b793b05e595f16b497c840d..0b74a78bd05b59c82de21463e21f384f09fb3b2b 100644 (file)
--- a/io.c
+++ b/io.c
@@ -17,7 +17,8 @@
 #include <linux/input.h>
 #include <poll.h>
 #include <stdint.h>
-#include "shellexec.h"
+
+#include "current.h"
 #include "io.h"
 
 extern int instance;
@@ -30,7 +31,7 @@ int InitRC(void)
        rc = open(RC_DEVICE, O_RDONLY | O_CLOEXEC);
        if(rc == -1)
        {
-               perror("shellexec <open remote control>");
+               perror(__plugin__ " <open remote control>");
                exit(1);
        }
        fcntl(rc, F_SETFL, O_NONBLOCK | O_SYNC);
index 17cfcd64528dd871f08ba74f8ea2c5ad183d64eb..e4511d28e96547f5c4d1dcb4602d1e0851aeddf4 100644 (file)
@@ -1,7 +1,9 @@
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
-#include "shellexec.h"
+
+#include "current.h"
+
 #include "text.h"
 #include "io.h"
 #include "gfx.h"
@@ -120,7 +122,7 @@ void put_instance(int pval)
 static void quit_signal(int sig)
 {
        put_instance(get_instance()-1);
-       printf("shellexec Version %.2f killed, signal %d\n",SH_VERSION,sig);
+       printf("%s Version %.2f killed, signal %d\n", __plugin__, SH_VERSION, sig);
        exit(1);
 }
 
@@ -1541,7 +1543,7 @@ int main (int argc, char **argv)
        char tstr[BUFSIZE], *rptr;
        PLISTENTRY pl;
 
-       printf("shellexec Version %.2f\n",SH_VERSION);
+       printf("%s Version %.2f\n", __plugin__, SH_VERSION);
        for(tv=1; tv<argc; tv++)
        {
                if(*argv[tv]=='/')
@@ -1622,7 +1624,7 @@ int main (int argc, char **argv)
        fb = open(FB_DEVICE, O_RDWR);
        if(fb == -1)
        {
-               perror("shellexec <open framebuffer device>");
+               perror(__plugin__ " <open framebuffer device>");
                exit(1);
        }
 
@@ -1632,31 +1634,31 @@ int main (int argc, char **argv)
        //init framebuffer
        if(ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1)
        {
-               perror("shellexec <FBIOGET_FSCREENINFO>\n");
+               perror(__plugin__ " <FBIOGET_FSCREENINFO>\n");
                return -1;
        }
        if(ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1)
        {
-               perror("shellexec <FBIOGET_VSCREENINFO>\n");
+               perror(__plugin__ " <FBIOGET_VSCREENINFO>\n");
                return -1;
        }
        if(!(lfb = (uint32_t*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0)))
        {
-               perror("shellexec <mapping of Framebuffer>\n");
+               perror(__plugin__ " <mapping of Framebuffer>\n");
                return -1;
        }
 
        //init fontlibrary
        if((error = FT_Init_FreeType(&library)))
        {
-               printf("shellexec <FT_Init_FreeType failed with Errorcode 0x%.2X>", error);
+               printf("%s <FT_Init_FreeType failed with Errorcode 0x%.2X>", __plugin__, error);
                munmap(lfb, fix_screeninfo.smem_len);
                return -1;
        }
 
        if((error = FTC_Manager_New(library, 1, 2, 0, &MyFaceRequester, NULL, &manager)))
        {
-               printf("shellexec <FTC_Manager_New failed with Errorcode 0x%.2X>\n", error);
+               printf("%s <FTC_Manager_New failed with Errorcode 0x%.2X>\n", __plugin__, error);
                FT_Done_FreeType(library);
                munmap(lfb, fix_screeninfo.smem_len);
                return -1;
@@ -1664,7 +1666,7 @@ int main (int argc, char **argv)
 
        if((error = FTC_SBitCache_New(manager, &cache)))
        {
-               printf("shellexec <FTC_SBitCache_New failed with Errorcode 0x%.2X>\n", error);
+               printf("%s <FTC_SBitCache_New failed with Errorcode 0x%.2X>\n", __plugin__, error);
                FTC_Manager_Done(manager);
                FT_Done_FreeType(library);
                munmap(lfb, fix_screeninfo.smem_len);
@@ -1674,7 +1676,7 @@ int main (int argc, char **argv)
        memset(&menu,0,sizeof(MENU));
        if(Check_Config())
        {
-               printf("shellexec <Check_Config> Unable to read Config %s\n",CFG_FILE);
+               printf("%s <Check_Config> Unable to read Config %s\n", __plugin__, CFG_FILE);
                FTC_Manager_Done(manager);
                FT_Done_FreeType(library);
                munmap(lfb, fix_screeninfo.smem_len);
@@ -1685,10 +1687,10 @@ int main (int argc, char **argv)
 
        if((error = FTC_Manager_LookupFace(manager, FONT, &face)))
        {
-               printf("shellexec <FTC_Manager_LookupFace failed with Errorcode 0x%.2X, trying default font>\n", error);
+               printf("%s <FTC_Manager_LookupFace failed with Errorcode 0x%.2X, trying default font>\n", __plugin__, error);
                if((error = FTC_Manager_LookupFace(manager, FONT2, &face)))
                {
-                       printf("shellexec <FTC_Manager_LookupFace failed with Errorcode 0x%.2X>\n", error);
+                       printf("%s <FTC_Manager_LookupFace failed with Errorcode 0x%.2X>\n", __plugin__, error);
                        FTC_Manager_Done(manager);
                        FT_Done_FreeType(library);
                        munmap(lfb, fix_screeninfo.smem_len);
@@ -1699,7 +1701,7 @@ int main (int argc, char **argv)
        }
        else
                desc.face_id = FONT;
-       printf("shellexec <FTC_Manager_LookupFace Font \"%s\" loaded>\n", desc.face_id);
+       printf("%s <FTC_Manager_LookupFace Font \"%s\" loaded>\n", __plugin__, desc.face_id);
 
        use_kerning = FT_HAS_KERNING(face);
        desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
@@ -1707,7 +1709,7 @@ int main (int argc, char **argv)
        //init backbuffer
        if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t))))
        {
-               printf("shellexec <allocating of Backbuffer failed>\n");
+               printf("%s <allocating of Backbuffer failed>\n", __plugin__);
                FTC_Manager_Done(manager);
                FT_Done_FreeType(library);
                munmap(lfb, fix_screeninfo.smem_len);
@@ -1733,7 +1735,7 @@ int main (int argc, char **argv)
        menu.act_entry=0;
        if(Get_Menu(1))
        {
-               printf("ShellExec <unable to create menu>\n");
+               printf("%s <unable to create menu>\n", __plugin__);
                FTC_Manager_Done(manager);
                FT_Done_FreeType(library);
                munmap(lfb, fix_screeninfo.smem_len);
index a32f83224e1221a1f1e0cf45e6de9d7c8ee8fd71..40e959c8236afb79db7b8f1e6f13ba8d1908d674 100644 (file)
@@ -116,7 +116,7 @@ enum {SMALL, MED, BIG};
 FT_Error               error;
 FT_Library             library;
 FTC_Manager            manager;
-FTC_SBitCache  cache;
+FTC_SBitCache          cache;
 FTC_SBit               sbit;
 #if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 0
 FTC_Image_Desc         desc;
index 2e153019002f76c1277e67094872f8e53e1eb56e..01a85b7ccc68384cebf566b31fa4478f5dbf4d33 100644 (file)
--- a/starter.c
+++ b/starter.c
@@ -24,7 +24,7 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <plugin.h>
-#define SCRIPT "shellexec"
+#define SCRIPT __plugin__
 
 void main()
 {
diff --git a/text.c b/text.c
index 36364af8ce3462c9d1fc3e0852ea5962e79e32a2..afb737c43947269fa4223ff59bd148b992a9889f 100644 (file)
--- a/text.c
+++ b/text.c
@@ -1,7 +1,6 @@
 #include "text.h"
 #include "gfx.h"
 #include "io.h"
-#include "shellexec.h"
 
 int FSIZE_BIG=28;
 int FSIZE_MED=24;
@@ -159,7 +158,7 @@ FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library lib, FT_Pointer request_
        result = FT_New_Face(lib, face_id, 0, aface);
 
        if (result)
-               printf("shellexec <Font \"%s\" failed>\n", (char*)face_id);
+               printf("%s <Font \"%s\" failed>\n", __plugin__, (char*)face_id);
 
        return result;
 }
@@ -253,20 +252,19 @@ int RenderChar(FT_ULong currentchar, int _sx, int _sy, int _ex, int color)
        //load char
        if(!(glyphindex = FT_Get_Char_Index(face, currentchar)))
        {
-               printf("shellexec <FT_Get_Char_Index for Char \"%c\" failed>\n", (int)currentchar);
+               printf("%s <FT_Get_Char_Index for Char \"%c\" failed>\n", __plugin__, (int)currentchar);
                return 0;
        }
 
        if((err = FTC_SBitCache_Lookup(cache, &desc, glyphindex, &sbit, NULL)))
        {
-               printf("shellexec <FTC_SBitCache_Lookup for Char \"%c\" failed with Errorcode 0x%.2X>\n", (int)currentchar, err);
+               printf("%s <FTC_SBitCache_Lookup for Char \"%c\" failed with Errorcode 0x%.2X>\n", __plugin__, (int)currentchar, err);
                return 0;
        }
 
        int _d = 0;
        if (1)
        {
-               //printf("shellexec <FTC_SBitCache_Lookup for Char \"g\" to get descender>\n");
                FT_UInt _i = FT_Get_Char_Index(face, 'g');
                FTC_SBit _g;
                FTC_SBitCache_Lookup(cache, &desc, _i, &_g, NULL);
diff --git a/text.h b/text.h
index ea34e760338dde8c083f67fed1283def9f44ac3a..83bafe344e49d54bffebfc7e09adc9a46a4252af 100644 (file)
--- a/text.h
+++ b/text.h
@@ -1,7 +1,7 @@
 #ifndef __TEXT_H__
 #define __TEXT_H__
 
-#include "shellexec.h"
+#include "current.h"
 
 extern int FSIZE_BIG;
 extern int FSIZE_MED;