From b039977f5f6efdc2c85d2d3876b17c88d60ef9e9 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Mon, 12 Mar 2018 00:17:31 +0100 Subject: [PATCH] move Test_XXX/Load_XXX/Save_XXX functions prototypes to fileformats.h --- src/Makefile.dep | 7 ++- src/fileformats.c | 1 + src/fileformats.h | 140 ++++++++++++++++++++++++++++++++++++++++++ src/loadsave.c | 111 +-------------------------------- src/miscfileformats.c | 1 + 5 files changed, 147 insertions(+), 113 deletions(-) create mode 100644 src/fileformats.h diff --git a/src/Makefile.dep b/src/Makefile.dep index 5fdc1d4f..ae99e7ed 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep @@ -22,7 +22,7 @@ $(OBJDIR)/factory.o: factory.c brush.h struct.h const.h buttons.h loadsave.h \ readline.h sdlscreen.h windows.h palette.h input.h help.h realpath.h \ setup.h tiles.h $(OBJDIR)/fileformats.o: fileformats.c errors.h global.h struct.h const.h \ - loadsave.h misc.h io.h pages.h windows.h + loadsave.h misc.h io.h pages.h windows.h fileformats.h $(OBJDIR)/filesel.o: filesel.c const.h struct.h global.h misc.h errors.h io.h \ windows.h sdlscreen.h loadsave.h mountlist.h engine.h readline.h input.h \ help.h unicode.h filesel.h @@ -49,7 +49,8 @@ $(OBJDIR)/loadrecoil.o: loadrecoil.c struct.h const.h global.h loadsave.h io.h \ errors.h recoil.h $(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h loadsave.h errors.h \ global.h io.h misc.h graph.h op_c.h colorred.h pages.h palette.h \ - sdlscreen.h windows.h engine.h brush.h setup.h filesel.h unicode.h + sdlscreen.h windows.h engine.h brush.h setup.h filesel.h unicode.h \ + fileformats.h $(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.h \ loadsave.h engine.h pages.h sdlscreen.h errors.h readini.h saveini.h \ io.h text.h setup.h windows.h brush.h palette.h realpath.h input.h \ @@ -59,7 +60,7 @@ $(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons. graph.h pages.h $(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \ global.h io.h libraw2crtc.h loadsave.h misc.h sdlscreen.h windows.h \ - oldies.h + oldies.h fileformats.h $(OBJDIR)/mountlist.o: mountlist.c mountlist.h $(OBJDIR)/oldies.o: oldies.c struct.h const.h global.h errors.h misc.h palette.h \ pages.h windows.h layers.h diff --git a/src/fileformats.c b/src/fileformats.c index bd26c49f..e1182838 100644 --- a/src/fileformats.c +++ b/src/fileformats.c @@ -68,6 +68,7 @@ #include "io.h" #include "pages.h" #include "windows.h" // Best_color() +#include "fileformats.h" #ifndef __no_pnglib__ static void Load_PNG_Sub(T_IO_Context * context, FILE * file); diff --git a/src/fileformats.h b/src/fileformats.h new file mode 100644 index 00000000..bf64fc4a --- /dev/null +++ b/src/fileformats.h @@ -0,0 +1,140 @@ +/* vim:expandtab:ts=2 sw=2: +*/ +/* Grafx2 - The Ultimate 256-color bitmap paint program + + Copyright 2018 Thomas Bernard + Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) + + Grafx2 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; version 2 + of the License. + + Grafx2 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 Grafx2; if not, see +*/ + +///@file fileformats.h +/// Saving and loading different picture formats. + +#ifndef FILEFORMATS_H_INCLUDED +#define FILEFORMATS_H_INCLUDED + +#include "loadsave.h" + +// -- PKM ------------------------------------------------------------------- +void Test_PKM(T_IO_Context *); +void Load_PKM(T_IO_Context *); +void Save_PKM(T_IO_Context *); + +// -- IFF ------------------------------------------------------------------- +void Test_LBM(T_IO_Context *); +void Test_PBM(T_IO_Context *); +void Test_ACBM(T_IO_Context *); +void Load_IFF(T_IO_Context *); +void Save_IFF(T_IO_Context *); + +// -- GIF ------------------------------------------------------------------- +void Test_GIF(T_IO_Context *); +void Load_GIF(T_IO_Context *); +void Save_GIF(T_IO_Context *); + +// -- PCX ------------------------------------------------------------------- +void Test_PCX(T_IO_Context *); +void Load_PCX(T_IO_Context *); +void Save_PCX(T_IO_Context *); + +// -- BMP ------------------------------------------------------------------- +void Test_BMP(T_IO_Context *); +void Load_BMP(T_IO_Context *); +void Save_BMP(T_IO_Context *); + +// -- IMG ------------------------------------------------------------------- +void Test_IMG(T_IO_Context *); +void Load_IMG(T_IO_Context *); +void Save_IMG(T_IO_Context *); + +// -- SCx ------------------------------------------------------------------- +void Test_SCx(T_IO_Context *); +void Load_SCx(T_IO_Context *); +void Save_SCx(T_IO_Context *); + +// -- CEL ------------------------------------------------------------------- +void Test_CEL(T_IO_Context *); +void Load_CEL(T_IO_Context *); +void Save_CEL(T_IO_Context *); + +// -- KCF ------------------------------------------------------------------- +void Test_KCF(T_IO_Context *); +void Load_KCF(T_IO_Context *); +void Save_KCF(T_IO_Context *); + +// -- PAL ------------------------------------------------------------------- +void Test_PAL(T_IO_Context *); +void Load_PAL(T_IO_Context *); +void Save_PAL(T_IO_Context *); + +// -- GPL ------------------------------------------------------------------- +void Test_GPL(T_IO_Context *); +void Load_GPL(T_IO_Context *); +void Save_GPL(T_IO_Context *); + +// -- PI1 ------------------------------------------------------------------- +void Test_PI1(T_IO_Context *); +void Load_PI1(T_IO_Context *); +void Save_PI1(T_IO_Context *); + +// -- PC1 ------------------------------------------------------------------- +void Test_PC1(T_IO_Context *); +void Load_PC1(T_IO_Context *); +void Save_PC1(T_IO_Context *); + +// -- NEO ------------------------------------------------------------------- +void Test_NEO(T_IO_Context *); +void Load_NEO(T_IO_Context *); +void Save_NEO(T_IO_Context *); + +// -- C64 ------------------------------------------------------------------- +void Test_C64(T_IO_Context *); +void Load_C64(T_IO_Context *); +void Save_C64(T_IO_Context *); + +// -- SCR (Amstrad CPC) +void Save_SCR(T_IO_Context *); + +// -- CM5 (Amstrad CPC) +void Test_CM5(T_IO_Context *); +void Load_CM5(T_IO_Context *); +void Save_CM5(T_IO_Context *); + +// -- PPH (Amstrad CPC) +void Test_PPH(T_IO_Context *); +void Load_PPH(T_IO_Context *); +void Save_PPH(T_IO_Context *); + +// -- XPM (X PixMap) +// Loading is done through SDL_Image +void Save_XPM(T_IO_Context*); + +// -- ICO (Windows ICO) +void Test_ICO(T_IO_Context *); +void Load_ICO(T_IO_Context *); +void Save_ICO(T_IO_Context *); + +// -- PNG ------------------------------------------------------------------- +#ifndef __no_pnglib__ +void Test_PNG(T_IO_Context *); +void Load_PNG(T_IO_Context *); +void Save_PNG(T_IO_Context *); +#endif + +// -- INFO (Amiga ICONS) ---------------------------------------------------- +void Test_INFO(T_IO_Context *); +void Load_INFO(T_IO_Context *); + +#endif diff --git a/src/loadsave.c b/src/loadsave.c index fe860644..a7bb37b6 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -63,116 +63,7 @@ #include "setup.h" #include "filesel.h" #include "unicode.h" - -// -- PKM ------------------------------------------------------------------- -void Test_PKM(T_IO_Context *); -void Load_PKM(T_IO_Context *); -void Save_PKM(T_IO_Context *); - -// -- IFF ------------------------------------------------------------------- -void Test_LBM(T_IO_Context *); -void Test_PBM(T_IO_Context *); -void Test_ACBM(T_IO_Context *); -void Load_IFF(T_IO_Context *); -void Save_IFF(T_IO_Context *); - -// -- GIF ------------------------------------------------------------------- -void Test_GIF(T_IO_Context *); -void Load_GIF(T_IO_Context *); -void Save_GIF(T_IO_Context *); - -// -- PCX ------------------------------------------------------------------- -void Test_PCX(T_IO_Context *); -void Load_PCX(T_IO_Context *); -void Save_PCX(T_IO_Context *); - -// -- BMP ------------------------------------------------------------------- -void Test_BMP(T_IO_Context *); -void Load_BMP(T_IO_Context *); -void Save_BMP(T_IO_Context *); - -// -- IMG ------------------------------------------------------------------- -void Test_IMG(T_IO_Context *); -void Load_IMG(T_IO_Context *); -void Save_IMG(T_IO_Context *); - -// -- SCx ------------------------------------------------------------------- -void Test_SCx(T_IO_Context *); -void Load_SCx(T_IO_Context *); -void Save_SCx(T_IO_Context *); - -// -- CEL ------------------------------------------------------------------- -void Test_CEL(T_IO_Context *); -void Load_CEL(T_IO_Context *); -void Save_CEL(T_IO_Context *); - -// -- KCF ------------------------------------------------------------------- -void Test_KCF(T_IO_Context *); -void Load_KCF(T_IO_Context *); -void Save_KCF(T_IO_Context *); - -// -- PAL ------------------------------------------------------------------- -void Test_PAL(T_IO_Context *); -void Load_PAL(T_IO_Context *); -void Save_PAL(T_IO_Context *); - -// -- GPL ------------------------------------------------------------------- -void Test_GPL(T_IO_Context *); -void Load_GPL(T_IO_Context *); -void Save_GPL(T_IO_Context *); - -// -- PI1 ------------------------------------------------------------------- -void Test_PI1(T_IO_Context *); -void Load_PI1(T_IO_Context *); -void Save_PI1(T_IO_Context *); - -// -- PC1 ------------------------------------------------------------------- -void Test_PC1(T_IO_Context *); -void Load_PC1(T_IO_Context *); -void Save_PC1(T_IO_Context *); - -// -- NEO ------------------------------------------------------------------- -void Test_NEO(T_IO_Context *); -void Load_NEO(T_IO_Context *); -void Save_NEO(T_IO_Context *); - -// -- C64 ------------------------------------------------------------------- -void Test_C64(T_IO_Context *); -void Load_C64(T_IO_Context *); -void Save_C64(T_IO_Context *); - -// -- SCR (Amstrad CPC) -void Save_SCR(T_IO_Context *); - -// -- CM5 (Amstrad CPC) -void Test_CM5(T_IO_Context *); -void Load_CM5(T_IO_Context *); -void Save_CM5(T_IO_Context *); - -// -- PPH (Amstrad CPC) -void Test_PPH(T_IO_Context *); -void Load_PPH(T_IO_Context *); -void Save_PPH(T_IO_Context *); - -// -- XPM (X PixMap) -// Loading is done through SDL_Image -void Save_XPM(T_IO_Context*); - -// -- ICO (Windows ICO) -void Test_ICO(T_IO_Context *); -void Load_ICO(T_IO_Context *); -void Save_ICO(T_IO_Context *); - -// -- PNG ------------------------------------------------------------------- -#ifndef __no_pnglib__ -void Test_PNG(T_IO_Context *); -void Load_PNG(T_IO_Context *); -void Save_PNG(T_IO_Context *); -#endif - -// -- INFO (Amiga ICONS) ---------------------------------------------------- -void Test_INFO(T_IO_Context *); -void Load_INFO(T_IO_Context *); +#include "fileformats.h" // -- SDL_Image ------------------------------------------------------------- // (TGA, BMP, PNM, XPM, XCF, PCX, GIF, JPG, TIF, IFF, PNG, ICO) diff --git a/src/miscfileformats.c b/src/miscfileformats.c index 0437b341..db0950b2 100644 --- a/src/miscfileformats.c +++ b/src/miscfileformats.c @@ -41,6 +41,7 @@ #include "struct.h" #include "windows.h" #include "oldies.h" +#include "fileformats.h" //////////////////////////////////// PAL //////////////////////////////////// //