Tool for making mng animations, for later, from fOSSiL.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@539 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
########################################################################
|
||||
# This is a GNU makefile - tested on CYGWIN only though.
|
||||
#
|
||||
# You may need to compile or install libmng before compiling this.
|
||||
# Libmng also requires zlib, jpeg and lcms
|
||||
#
|
||||
|
||||
TARGET = makemng
|
||||
# These flags are needed to get it to compile with libmng.dll on CYGWIN
|
||||
# CYGWINFLAGS = -DMNG_USE_DLL
|
||||
CYGWINFLAGS =
|
||||
MNGFLAGS = -I. -DMNG_SKIP_LCMS -DMNG_SKIP_IJG6B \
|
||||
-DMNG_SUPPORT_READ -DMNG_SUPPORT_WRITE -DMNG_SUPPORT_DISPLAY \
|
||||
-DMNG_ACCESS_CHUNKS
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -W -Wall -O0 # -g
|
||||
LIBS = -L/usr/local/lib -lmng -lm -lz -ljpeg -llcms
|
||||
LDFLAGS=
|
||||
|
||||
BINS = $(TARGET) $(TARGET).exe
|
||||
SRCS = makemng.c filelist.c
|
||||
OBJS = makemng.o filelist.o
|
||||
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) -o $@ $*.c $(MNGFLAGS) $(CYGWINFLAGS)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(CC) -o $(TARGET) $(OBJS) $(LIBS) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(BINS) *.o
|
||||
|
||||
Executable
BIN
Binary file not shown.
Executable
+276
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* This program 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* This file contains two versions of LoadDirEntryTable; one for Windows, and
|
||||
* one for other systems (POSIX).
|
||||
*/
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
char**
|
||||
make_file_list (const char* pattern, int* pnum_entries)
|
||||
{
|
||||
int num_entries, length;
|
||||
char** StringTable;
|
||||
char** lpLastOffs;
|
||||
|
||||
num_entries = 0;
|
||||
StringTable = 0;
|
||||
do
|
||||
{
|
||||
int slen;
|
||||
long handle;
|
||||
struct _finddata_t f;
|
||||
|
||||
if (num_entries == 0)
|
||||
length = 0;
|
||||
else
|
||||
{
|
||||
slen = (num_entries + 1) * sizeof (char*);
|
||||
StringTable = (char**) malloc (slen + length);
|
||||
if (StringTable == 0)
|
||||
break;
|
||||
|
||||
lpLastOffs = StringTable;
|
||||
*lpLastOffs = (char*)StringTable + slen;
|
||||
|
||||
num_entries = 0;
|
||||
length = slen;
|
||||
}
|
||||
|
||||
handle = _findfirst (pattern, &f);
|
||||
if (handle != -1)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (f.attrib & (_A_HIDDEN | _A_SUBDIR | _A_SYSTEM))
|
||||
continue;
|
||||
|
||||
slen = strlen (f.name) + 1;
|
||||
length += slen;
|
||||
|
||||
if (StringTable)
|
||||
{
|
||||
char *lpStr;
|
||||
char **lpLo, **lpHi;
|
||||
|
||||
lpLo = StringTable;
|
||||
lpHi = lpLastOffs - 1;
|
||||
while (lpLo <= lpHi)
|
||||
{
|
||||
char c1, c2;
|
||||
char *pStr;
|
||||
int LocLen;
|
||||
char **lpMid;
|
||||
|
||||
lpMid = lpLo + ((lpHi - lpLo) >> 1);
|
||||
|
||||
LocLen = lpMid[1] - lpMid[0];
|
||||
if (LocLen > slen)
|
||||
LocLen = slen;
|
||||
|
||||
lpStr = lpMid[0];
|
||||
pStr = f.name;
|
||||
while (LocLen--
|
||||
&& (c1 = toupper (*lpStr++))
|
||||
== (c2 = toupper (*pStr++)))
|
||||
;
|
||||
|
||||
if (c1 <= c2)
|
||||
lpLo = lpMid + 1;
|
||||
else
|
||||
lpHi = lpMid - 1;
|
||||
}
|
||||
|
||||
lpStr = lpLo[0];
|
||||
memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]);
|
||||
strcpy (lpStr, f.name);
|
||||
|
||||
for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi)
|
||||
lpHi[1] = lpHi[0] + slen;
|
||||
}
|
||||
|
||||
++num_entries;
|
||||
|
||||
} while (_findnext (handle, &f) == 0);
|
||||
|
||||
_findclose (handle);
|
||||
}
|
||||
} while (num_entries && StringTable == 0);
|
||||
|
||||
if (StringTable == 0)
|
||||
*pnum_entries = 0;
|
||||
else
|
||||
*pnum_entries = num_entries;
|
||||
|
||||
return StringTable;
|
||||
}
|
||||
|
||||
#else /* ! defined(WIN32) */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <fnmatch.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
char**
|
||||
make_file_list (const char* pattern, int* pnum_entries)
|
||||
{
|
||||
size_t num_entries, length;
|
||||
char** StringTable;
|
||||
char** lpLastOffs;
|
||||
char* slash; // Pointer inside pattern to the last /
|
||||
char path[PATH_MAX]; // buffer for a filename with path
|
||||
char* file; // Pointer inside path to the filename
|
||||
size_t pathlen; // length of path, excluding last / and filename
|
||||
|
||||
slash = (char*) strrchr ((const char *) pattern, '/');
|
||||
if (slash == NULL)
|
||||
{
|
||||
pathlen = 1;
|
||||
path[0] = '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
pathlen = slash - pattern;
|
||||
memcpy (path, pattern, pathlen);
|
||||
pattern = slash + 1;
|
||||
}
|
||||
file = path + pathlen + 1;
|
||||
|
||||
num_entries = 0;
|
||||
StringTable = 0;
|
||||
do
|
||||
{
|
||||
int slen;
|
||||
DIR *handle;
|
||||
|
||||
if (num_entries == 0)
|
||||
length = 0;
|
||||
else
|
||||
{
|
||||
slen = (num_entries + 1) * sizeof (char*);
|
||||
StringTable = (char**) malloc (slen + length);
|
||||
if (StringTable == 0)
|
||||
break;
|
||||
|
||||
lpLastOffs = StringTable;
|
||||
*lpLastOffs = (char*)StringTable + slen;
|
||||
|
||||
num_entries = 0;
|
||||
length = slen;
|
||||
}
|
||||
|
||||
path[pathlen] = '\0'; // strip any file part
|
||||
handle = opendir((const char *) path);
|
||||
if (handle != NULL)
|
||||
{
|
||||
path[pathlen] = '/';
|
||||
// change the 0 char to a slash; a filename will be
|
||||
// attached here.
|
||||
while (1)
|
||||
{
|
||||
struct dirent *de;
|
||||
struct stat sb;
|
||||
|
||||
de = readdir(handle);
|
||||
if (de == NULL)
|
||||
break;
|
||||
if (de->d_name[0] == '.')
|
||||
continue;
|
||||
strcpy (file, de->d_name);
|
||||
// attach the filename to path
|
||||
if (stat(path, &sb) == -1)
|
||||
continue;
|
||||
if (!S_ISREG(sb.st_mode))
|
||||
continue;
|
||||
if (fnmatch(pattern, de->d_name, 0) != 0)
|
||||
continue;
|
||||
|
||||
slen = strlen (de->d_name) + 1;
|
||||
length += slen;
|
||||
|
||||
if (StringTable)
|
||||
{
|
||||
char *lpStr;
|
||||
char **lpLo, **lpHi;
|
||||
|
||||
lpLo = StringTable;
|
||||
lpHi = lpLastOffs - 1;
|
||||
while (lpLo <= lpHi)
|
||||
{
|
||||
char c1, c2;
|
||||
char *pStr;
|
||||
int LocLen;
|
||||
char **lpMid;
|
||||
|
||||
lpMid = lpLo + ((lpHi - lpLo) >> 1);
|
||||
|
||||
LocLen = lpMid[1] - lpMid[0];
|
||||
if (LocLen > slen)
|
||||
LocLen = slen;
|
||||
|
||||
lpStr = lpMid[0];
|
||||
pStr = de->d_name;
|
||||
while (LocLen--
|
||||
&& (c1 = toupper (*lpStr++))
|
||||
== (c2 = toupper (*pStr++)))
|
||||
;
|
||||
|
||||
if (c1 <= c2)
|
||||
lpLo = lpMid + 1;
|
||||
else
|
||||
lpHi = lpMid - 1;
|
||||
}
|
||||
|
||||
lpStr = lpLo[0];
|
||||
memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]);
|
||||
strcpy (lpStr, de->d_name);
|
||||
|
||||
for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi)
|
||||
lpHi[1] = lpHi[0] + slen;
|
||||
}
|
||||
|
||||
++num_entries;
|
||||
}
|
||||
closedir(handle);
|
||||
}
|
||||
} while (num_entries && StringTable == 0);
|
||||
|
||||
if (StringTable == 0)
|
||||
*pnum_entries = 0;
|
||||
else
|
||||
*pnum_entries = num_entries;
|
||||
|
||||
return StringTable;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
free_file_list (char** list)
|
||||
{
|
||||
if (list)
|
||||
free(list);
|
||||
}
|
||||
Executable
+1765
File diff suppressed because it is too large
Load Diff
Executable
+114
@@ -0,0 +1,114 @@
|
||||
# Microsoft Developer Studio Project File - Name="makemng" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=makemng - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "makemng.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "makemng.mak" CFG="makemng - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "makemng - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "makemng - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=xicl6.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "makemng - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "NDEBUG" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /D "ZLIB_DLL" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=xilink6.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /machine:I386 /libpath:"."
|
||||
|
||||
!ELSEIF "$(CFG)" == "makemng - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "_DEBUG" /D "ZLIB_DLL" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=xilink6.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"."
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "makemng - Win32 Release"
|
||||
# Name "makemng - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\filelist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\getopt\getopt.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\makemng.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\getopt.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "makemng"=.\makemng.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Reference in New Issue
Block a user