From 8ed5019b02361d3ea04599ef7621b1410007fe01 Mon Sep 17 00:00:00 2001 From: Franck Charlet Date: Sun, 15 Feb 2009 17:03:18 +0000 Subject: [PATCH] - Fixed the usual problem due to non posix code - Made the png lib optional with: __no_pnglib__ git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@630 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- .DS_Store | Bin 15364 -> 15364 bytes Grafx2.xcodeproj/project.pbxproj | 28 ++++++++++----- Grafx2.xcodeproj/xx.pbxuser | 18 +++++----- Grafx2.xcodeproj/xx.perspective | 57 +++++++++++++++---------------- const.h | 7 ++++ init.c | 4 +++ loadsave.c | 15 +++++++- 7 files changed, 81 insertions(+), 48 deletions(-) diff --git a/.DS_Store b/.DS_Store index 574bedb82b7883e560a7ec8d9de2c6e5521edec8..bda59ceb66a31defcc56b79a42f8fddab6c87e63 100644 GIT binary patch delta 141 zcmZpvXsMXs&*--?U^hRb-)0_xTGq*)qKY~xnK{WxIr&Kp3=9fD3s?W4BeF6Js1&w$f07gMF!TTGq`sMfJEQHUw;DS7-upYM3?)X?zl%*uV<_e<2WB diff --git a/Grafx2.xcodeproj/project.pbxproj b/Grafx2.xcodeproj/project.pbxproj index a3bf47ff..6af167b5 100644 --- a/Grafx2.xcodeproj/project.pbxproj +++ b/Grafx2.xcodeproj/project.pbxproj @@ -16,6 +16,9 @@ F51CBD2F0EC8A3E1005C06AC /* colorfont.pcx in Copy fonts */ = {isa = PBXBuildFile; fileRef = F51CBD2C0EC8A3E1005C06AC /* colorfont.pcx */; }; F51CBD300EC8A3E1005C06AC /* Tuffy.ttf in Copy fonts */ = {isa = PBXBuildFile; fileRef = F51CBD2D0EC8A3E1005C06AC /* Tuffy.ttf */; }; F5A33E6A0EC893F800F8052D /* 8pxfont.png in Copy fonts */ = {isa = PBXBuildFile; fileRef = F5A33E690EC893F800F8052D /* 8pxfont.png */; }; + F5AC28BC0F4873C700455509 /* hotkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AC28B90F4873C700455509 /* hotkeys.c */; }; + F5AC28BD0F4873C700455509 /* input.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AC28BA0F4873C700455509 /* input.c */; }; + F5AC28BE0F4873C700455509 /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AC28BB0F4873C700455509 /* realpath.c */; }; F5AD4B1F0EA8CCF0009CCAC4 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = F5AD4B1E0EA8CCF0009CCAC4 /* version.c */; }; F5AE6F990EDA119D000CE0EF /* GrafX2_Classic.gif in Copy fonts */ = {isa = PBXBuildFile; fileRef = F5AE6F980EDA119D000CE0EF /* GrafX2_Classic.gif */; }; F5AE83FD0ECF8FD300200704 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5AE83FC0ECF8FD300200704 /* ApplicationServices.framework */; }; @@ -50,10 +53,10 @@ F5B19BA30EA4BE3E003F4BA4 /* shade.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B8B0EA4BE3E003F4BA4 /* shade.c */; }; F5B19BA40EA4BE3E003F4BA4 /* special.c in Sources */ = {isa = PBXBuildFile; fileRef = F5B19B8C0EA4BE3E003F4BA4 /* special.c */; }; F5B19BE10EA4C65A003F4BA4 /* gfx2.cfg in Resources */ = {isa = PBXBuildFile; fileRef = F5B19BDF0EA4C65A003F4BA4 /* gfx2.cfg */; }; - F5B19BE20EA4C65A003F4BA4 /* gfx2.dat in Resources */ = {isa = PBXBuildFile; fileRef = F5B19BE00EA4C65A003F4BA4 /* gfx2.dat */; }; F5B19C1D0EA4D71C003F4BA4 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */; }; F5B19C3D0EA4DC91003F4BA4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F5B19C3B0EA4DC91003F4BA4 /* InfoPlist.strings */; }; - F5B1EE850EAD0F4E00B087B5 /* gfx2.ini in Resources */ = {isa = PBXBuildFile; fileRef = F5B1EE840EAD0F4E00B087B5 /* gfx2.ini */; }; + F5B1EE850EAD0F4E00B087B5 /* gfx2def.ini in Resources */ = {isa = PBXBuildFile; fileRef = F5B1EE840EAD0F4E00B087B5 /* gfx2def.ini */; }; + F5B1EE850EAD0F4E00B087B6 /* gfx2gui.gif in Resources */ = {isa = PBXBuildFile; fileRef = F5B1EE840EAD0F4E00B087B6 /* gfx2gui.gif */; }; F5DCE2BC0EA5116A0065B0EF /* SDL_ttf in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = F5DCE2BE0EA5118F0065B0EF /* SDL_ttf */; }; F5DCE2BC0EA5116B0065B0EF /* SDL_image in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = F5DCE2BB0EA5116B0065B0EF /* SDL_image */; }; F5DCE2BE0EA5118E0065B0EF /* SDL in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = F5DCE2BD0EA5118E0065B0EF /* SDL */; }; @@ -126,6 +129,9 @@ F51CBD2C0EC8A3E1005C06AC /* colorfont.pcx */ = {isa = PBXFileReference; lastKnownFileType = file; name = colorfont.pcx; path = fonts/colorfont.pcx; sourceTree = ""; }; F51CBD2D0EC8A3E1005C06AC /* Tuffy.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = Tuffy.ttf; path = fonts/Tuffy.ttf; sourceTree = ""; }; F5A33E690EC893F800F8052D /* 8pxfont.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 8pxfont.png; path = fonts/8pxfont.png; sourceTree = ""; }; + F5AC28B90F4873C700455509 /* hotkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = hotkeys.c; sourceTree = ""; }; + F5AC28BA0F4873C700455509 /* input.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = input.c; sourceTree = ""; }; + F5AC28BB0F4873C700455509 /* realpath.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = realpath.c; sourceTree = ""; }; F5AD4B1E0EA8CCF0009CCAC4 /* version.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = ""; }; F5AE6F980EDA119D000CE0EF /* GrafX2_Classic.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = GrafX2_Classic.gif; path = fonts/GrafX2_Classic.gif; sourceTree = ""; }; F5AE83FC0ECF8FD300200704 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; @@ -162,10 +168,10 @@ F5B19B8B0EA4BE3E003F4BA4 /* shade.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = shade.c; sourceTree = ""; }; F5B19B8C0EA4BE3E003F4BA4 /* special.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = special.c; sourceTree = ""; }; F5B19BDF0EA4C65A003F4BA4 /* gfx2.cfg */ = {isa = PBXFileReference; lastKnownFileType = file; path = gfx2.cfg; sourceTree = ""; }; - F5B19BE00EA4C65A003F4BA4 /* gfx2.dat */ = {isa = PBXFileReference; lastKnownFileType = file; path = gfx2.dat; sourceTree = ""; }; F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = SYSTEM_DEVELOPER_DIR; }; F5B19C3C0EA4DC91003F4BA4 /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - F5B1EE840EAD0F4E00B087B5 /* gfx2.ini */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = gfx2.ini; path = dat/gfx2.ini; sourceTree = ""; }; + F5B1EE840EAD0F4E00B087B5 /* gfx2def.ini */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = gfx2def.ini; sourceTree = ""; }; + F5B1EE840EAD0F4E00B087B6 /* gfx2gui.gif */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = gfx2gui.gif; sourceTree = ""; }; F5DCE2BB0EA5116B0065B0EF /* SDL_image */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = SDL_image; path = /Library/Frameworks/SDL_image.framework/Versions/A/SDL_image; sourceTree = ""; }; F5DCE2BD0EA5118E0065B0EF /* SDL */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = SDL; path = /Library/Frameworks/SDL.framework/Versions/A/SDL; sourceTree = ""; }; F5DCE2BE0EA5118F0065B0EF /* SDL_ttf */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = SDL_ttf; path = /Library/Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf; sourceTree = ""; }; @@ -227,6 +233,9 @@ 29B97314FDCFA39411CA2CEA /* Grafx2 */ = { isa = PBXGroup; children = ( + F5AC28B90F4873C700455509 /* hotkeys.c */, + F5AC28BA0F4873C700455509 /* input.c */, + F5AC28BB0F4873C700455509 /* realpath.c */, F5AED03C0F1989E00090A93F /* mountlist.c */, F5AFA0070EFAC7D300663B43 /* brush.c */, F5AFA0080EFAC7D300663B43 /* pxsimple.c */, @@ -242,7 +251,8 @@ F5A33E690EC893F800F8052D /* 8pxfont.png */, F5B138C20EB71D28000B83CC /* SDL_ttf */, F5B138930EB71977000B83CC /* texte.c */, - F5B1EE840EAD0F4E00B087B5 /* gfx2.ini */, + F5B1EE840EAD0F4E00B087B5 /* gfx2def.ini */, + F5B1EE840EAD0F4E00B087B6 /* gfx2gui.gif */, F5AD4B1E0EA8CCF0009CCAC4 /* version.c */, F5DCE2BD0EA5118E0065B0EF /* SDL */, F5DCE2BB0EA5116B0065B0EF /* SDL_image */, @@ -250,7 +260,6 @@ F5B19C3B0EA4DC91003F4BA4 /* InfoPlist.strings */, F5B19C1C0EA4D71C003F4BA4 /* CoreFoundation.framework */, F5B19BDF0EA4C65A003F4BA4 /* gfx2.cfg */, - F5B19BE00EA4C65A003F4BA4 /* gfx2.dat */, F5B19B750EA4BE3E003F4BA4 /* aide.c */, F5B19B760EA4BE3E003F4BA4 /* boutons.c */, F5B19B770EA4BE3E003F4BA4 /* clavier.c */, @@ -355,9 +364,9 @@ buildActionMask = 2147483647; files = ( F5B19BE10EA4C65A003F4BA4 /* gfx2.cfg in Resources */, - F5B19BE20EA4C65A003F4BA4 /* gfx2.dat in Resources */, F5B19C3D0EA4DC91003F4BA4 /* InfoPlist.strings in Resources */, - F5B1EE850EAD0F4E00B087B5 /* gfx2.ini in Resources */, + F5B1EE850EAD0F4E00B087B5 /* gfx2def.ini in Resources */, + F5B1EE850EAD0F4E00B087B6 /* gfx2gui.gif in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -400,6 +409,9 @@ F5AFA0110EFAC7D300663B43 /* setup.c in Sources */, F5AFA0120EFAC7D300663B43 /* windows.c in Sources */, F5AED03E0F1989E00090A93F /* mountlist.c in Sources */, + F5AC28BC0F4873C700455509 /* hotkeys.c in Sources */, + F5AC28BD0F4873C700455509 /* input.c in Sources */, + F5AC28BE0F4873C700455509 /* realpath.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Grafx2.xcodeproj/xx.pbxuser b/Grafx2.xcodeproj/xx.pbxuser index f0d0118f..f0ecd21a 100644 --- a/Grafx2.xcodeproj/xx.pbxuser +++ b/Grafx2.xcodeproj/xx.pbxuser @@ -77,7 +77,7 @@ 43, 20, 79, - 587, + 88, ); PBXFileTableDataSourceColumnsKey = ( PBXFileDataSource_FiletypeID, @@ -165,8 +165,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 254188623; - PBXWorkspaceStateSaveDate = 254188623; + PBXPerProjectTemplateStateSaveDate = 256409268; + PBXWorkspaceStateSaveDate = 256409268; }; sourceControlManager = F5B19B690EA4BD79003F4BA4 /* Source Control */; userBuildSettings = { @@ -286,17 +286,17 @@ }; F5B19B7C0EA4BE3E003F4BA4 /* init.c */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1020, 42104}}"; - sepNavSelRange = "{79989, 0}"; - sepNavVisRect = "{{0, 4294}, {660, 146}}"; + sepNavIntBoundsRect = "{{0, 0}, {1660, 46018}}"; + sepNavSelRange = "{81112, 1}"; + sepNavVisRect = "{{0, 44925}, {867, 536}}"; sepNavWindowFrame = "{{12, 46}, {906, 665}}"; }; }; F5B19B7F0EA4BE3E003F4BA4 /* loadsave.c */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1700, 101574}}"; - sepNavSelRange = "{29459, 0}"; - sepNavVisRect = "{{0, 18552}, {867, 536}}"; + sepNavIntBoundsRect = "{{0, 0}, {1700, 112651}}"; + sepNavSelRange = "{1098, 24}"; + sepNavVisRect = "{{0, 331}, {867, 536}}"; sepNavWindowFrame = "{{15, 76}, {906, 665}}"; }; }; diff --git a/Grafx2.xcodeproj/xx.perspective b/Grafx2.xcodeproj/xx.perspective index 4d20aa45..a529bbe6 100644 --- a/Grafx2.xcodeproj/xx.perspective +++ b/Grafx2.xcodeproj/xx.perspective @@ -188,9 +188,9 @@ PerspectiveWidths - 1469 - 1469 - 1469 + 970 + 970 + 970 Perspectives @@ -264,12 +264,11 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 1 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {305, 402}} + {{0, 124}, {305, 575}} PBXTopSmartGroupGIDs @@ -279,7 +278,7 @@ GeometryConfiguration Frame - {{0, 0}, {322, 420}} + {{0, 0}, {322, 593}} GroupTreeTableConfiguration MainColumn @@ -321,7 +320,7 @@ GeometryConfiguration Frame - {{0, 0}, {1142, 0}} + {{0, 0}, {643, 0}} Module PBXNavigatorGroup @@ -330,7 +329,7 @@ Proportion - 415pt + 588pt Tabs @@ -344,7 +343,7 @@ GeometryConfiguration Frame - {{10, 27}, {1142, 388}} + {{10, 27}, {643, 561}} Module XCDetailModule @@ -385,7 +384,7 @@ Proportion - 1142pt + 643pt Name @@ -403,11 +402,11 @@ TableOfContents - F5AED0690F1999120090A93F + F5D646000F487ECB007E515F 1CA23ED40692098700951B8B - F5AED06A0F1999120090A93F + F5D646010F487ECB007E515F F5A33EBD0EC89C3000F8052D - F5AED06B0F1999120090A93F + F5D646020F487ECB007E515F 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -473,7 +472,7 @@ PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {252, 590}} + {{0, 0}, {252, 575}} PBXTopSmartGroupGIDs @@ -483,14 +482,14 @@ GeometryConfiguration Frame - {{0, 0}, {269, 608}} + {{0, 0}, {269, 593}} GroupTreeTableConfiguration MainColumn 252 RubberWindowFrame - 289 18 1045 649 0 0 1024 746 + 40 86 970 634 0 0 1024 746 Module PBXSmartGroupTreeModule @@ -527,9 +526,9 @@ GeometryConfiguration Frame - {{0, 0}, {771, 0}} + {{0, 0}, {696, 0}} RubberWindowFrame - 289 18 1045 649 0 0 1024 746 + 40 86 970 634 0 0 1024 746 Module PBXNavigatorGroup @@ -538,12 +537,10 @@ Proportion - 603pt + 588pt Tabs - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -558,9 +555,9 @@ GeometryConfiguration Frame - {{10, 27}, {771, 576}} + {{10, 27}, {696, 561}} RubberWindowFrame - 289 18 1045 649 0 0 1024 746 + 40 86 970 634 0 0 1024 746 Module PBXBuildResultsModule @@ -622,7 +619,7 @@ Proportion - 771pt + 696pt Name @@ -640,14 +637,14 @@ TableOfContents - F5AD90FC0F269BDD00DE11EE + F5D646030F487ECB007E515F 1CA23EE50692099D00951B8B - F5AD90FD0F269BDD00DE11EE + F5D646040F487ECB007E515F F5A33EC20EC89C3000F8052D - F5AD90FE0F269BDD00DE11EE + F5D646050F487ECB007E515F XCMainBuildResultsModuleGUID 1CA23EE80692099D00951B8B - F5AD90FF0F269BDD00DE11EE + F5D646060F487ECB007E515F ToolbarConfiguration xcode.toolbar.config.buildAndRun @@ -795,7 +792,7 @@ PerspectivesBarVisible PinnedNavigatorIdentifier - F5AD90FA0F269A5E00DE11EE + F5543CFC0F487AC10054D4F9 ShelfIsVisible SourceDescription @@ -821,7 +818,7 @@ /Users/xx/Grafx2/Grafx2.xcodeproj WindowString - 289 18 1045 649 0 0 1024 746 + 40 86 970 634 0 0 1024 746 WindowTools diff --git a/const.h b/const.h index 32085466..357b24c0 100644 --- a/const.h +++ b/const.h @@ -89,9 +89,16 @@ // Les différents formats de fichiers: +#ifndef __no_pnglib__ #define NB_FORMATS_CONNUS 13 // Nombre de formats connus (devrait être la valeur maximale de NB_FORMATS_LOAD et NB_FORMATS_SAVE, mais plus généralement: Card({NB_FORMATS_LOAD} UNION {NB_FORMATS_SAVE})) #define NB_FORMATS_LOAD 13 // Nombre de formats que l'on sait charger #define NB_FORMATS_SAVE 13 // Nombre de formats que l'on sait sauver +#else +// Without pnglib +#define NB_FORMATS_CONNUS 12 // Nombre de formats connus (devrait être la valeur maximale de NB_FORMATS_LOAD et NB_FORMATS_SAVE, mais plus généralement: Card({NB_FORMATS_LOAD} UNION {NB_FORMATS_SAVE})) +#define NB_FORMATS_LOAD 12 // Nombre de formats que l'on sait charger +#define NB_FORMATS_SAVE 12 // Nombre de formats que l'on sait sauver +#endif enum FORMATS_RECONNUS { diff --git a/init.c b/init.c index fb661419..6249931a 100644 --- a/init.c +++ b/init.c @@ -49,6 +49,10 @@ #include #endif +#if defined(__macosx__) +#define __p_sig_fn_t sig_t +#endif + #include "const.h" #include "struct.h" #include "global.h" diff --git a/loadsave.c b/loadsave.c index 59636aae..3d228186 100644 --- a/loadsave.c +++ b/loadsave.c @@ -22,6 +22,10 @@ */ #define _XOPEN_SOURCE +#if defined(__macosx__) +#define __no_pnglib__ +#endif + #include #include #include @@ -29,7 +33,9 @@ #include #include #include +#ifndef __no_pnglib__ #include +#endif #include "const.h" #include "struct.h" @@ -108,9 +114,11 @@ void Load_PC1(void); void Save_PC1(void); // -- PNG ------------------------------------------------------------------- +#ifndef __no_pnglib__ void Test_PNG(void); void Load_PNG(void); void Save_PNG(void); +#endif T_Format FormatFichier[NB_FORMATS_CONNUS] = { {"pkm", Test_PKM, Load_PKM, Save_PKM, 1, 1}, @@ -125,7 +133,9 @@ T_Format FormatFichier[NB_FORMATS_CONNUS] = { {"cel", Test_CEL, Load_CEL, Save_CEL, 1, 0}, {"kcf", Test_KCF, Load_KCF, Save_KCF, 0, 0}, {"pal", Test_PAL, Load_PAL, Save_PAL, 0, 0}, +#ifndef __no_pnglib__ {"png", Test_PNG, Load_PNG, Save_PNG, 1, 1} +#endif }; // Cette variable est alimentée après chargement réussi d'une image. @@ -5550,6 +5560,8 @@ void Load_TGA(char * nom,Bitmap24B * dest,int * larg,int * haut) ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// +#ifndef __no_pnglib__ + // -- Tester si un fichier est au format PNG -------------------------------- void Test_PNG(void) { @@ -5854,7 +5866,7 @@ void Save_PNG(void) } // S'il y a eu une erreur de sauvegarde, on ne va tout de même pas laisser - // ce fichier pourri traîner... Ca fait pas propre. + // ce fichier pourri trainait... Ca fait pas propre. if (Erreur_fichier) remove(Nom_du_fichier); @@ -5864,6 +5876,7 @@ void Save_PNG(void) row_pointers=NULL; } } +#endif // __no_pnglib__ // Saves an image. // This routine will only be called when all hope is lost, memory thrashed, etc