summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorberkeviktor@aol.com <berkeviktor@aol.com>2010-04-02 07:29:16 +0200
committerberkeviktor@aol.com <berkeviktor@aol.com>2010-04-02 07:29:16 +0200
commitc7ec88c88adb4f15b154ad125977d9c2c4ae4956 (patch)
tree09b886a96255b141e59747b3d3b375b576b2cdc5 /src
parent876a185af371a92d73725a25ccda3a41fdaebd37 (diff)
move additions to own repo, so that patch contains only modifications
Diffstat (limited to 'src')
-rw-r--r--src/common/dirent.h230
-rw-r--r--src/common/makefile.mak13
-rw-r--r--src/fe-gtk/makefile.mak37
-rw-r--r--src/makefile.mak18
-rw-r--r--src/makeinc.mak125
-rw-r--r--src/pixmaps/makefile.mak18
6 files changed, 441 insertions, 0 deletions
diff --git a/src/common/dirent.h b/src/common/dirent.h
new file mode 100644
index 00000000..64251740
--- /dev/null
+++ b/src/common/dirent.h
@@ -0,0 +1,230 @@
+/*****************************************************************************
+ * dirent.h - dirent API for Microsoft Visual Studio
+ *
+ * Copyright (C) 2006 Toni Ronkko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * ``Software''), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Dec 15, 2009, John Cunningham
+ * Added rewinddir member function
+ *
+ * Jan 18, 2008, Toni Ronkko
+ * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string
+ * between multi-byte and unicode representations.  This makes the
+ * code simpler and also allows the code to be compiled under MingW.  Thanks
+ * to Azriel Fasten for the suggestion.
+ *
+ * Mar 4, 2007, Toni Ronkko
+ * Bug fix: due to the strncpy_s() function this file only compiled in
+ * Visual Studio 2005.  Using the new string functions only when the
+ * compiler version allows.
+ *
+ * Nov  2, 2006, Toni Ronkko
+ * Major update: removed support for Watcom C, MS-DOS and Turbo C to
+ * simplify the file, updated the code to compile cleanly on Visual
+ * Studio 2005 with both unicode and multi-byte character strings,
+ * removed rewinddir() as it had a bug.
+ *
+ * Aug 20, 2006, Toni Ronkko
+ * Removed all remarks about MSVC 1.0, which is antiqued now.  Simplified
+ * comments by removing SGML tags.
+ *
+ * May 14 2002, Toni Ronkko
+ * Embedded the function definitions directly to the header so that no
+ * source modules need to be included in the Visual Studio project.  Removed
+ * all the dependencies to other projects so that this very header can be
+ * used independently.
+ *
+ * May 28 1998, Toni Ronkko
+ * First version.
+ *****************************************************************************/
+#ifndef DIRENT_H
+#define DIRENT_H
+
+#include <windows.h>
+#include <string.h>
+#include <assert.h>
+
+
+typedef struct dirent
+{
+   char d_name[MAX_PATH + 1]; /* current dir entry (multi-byte char string) */
+   WIN32_FIND_DATAA data;     /* file attributes */
+}  dirent;
+
+
+typedef struct DIR
+{
+   dirent current;            /* Current directory entry */
+   int    cached;             /* Indicates un-processed entry in memory */
+   HANDLE search_handle;      /* File search handle */
+   char   patt[MAX_PATH + 3]; /* search pattern (3 = pattern + "\\*\0") */
+} DIR;
+
+
+/* Forward declarations */
+static DIR *opendir (const char *dirname);
+static struct dirent *readdir (DIR *dirp);
+static int closedir (DIR *dirp);
+static void rewinddir(DIR* dirp);
+
+
+/* Use the new safe string functions introduced in Visual Studio 2005 */
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE)
+#else
+# define STRNCPY(dest,src,size) strncpy((dest),(src),(size))
+#endif
+
+
+/*****************************************************************************
+ * Open directory stream DIRNAME for read and return a pointer to the
+ * internal working area that is used to retrieve individual directory
+ * entries.
+ */
+static DIR *opendir(const char *dirname)
+{
+   DIR *dirp;
+   assert (dirname != NULL);
+   assert (strlen (dirname) < MAX_PATH);
+
+   /* construct new DIR structure */
+   dirp = (DIR*) malloc (sizeof (struct DIR));
+   if (dirp != NULL) {
+      char *p;
+
+      /* take directory name... */
+      STRNCPY (dirp->patt, dirname, sizeof(dirp->patt));
+      dirp->patt[MAX_PATH] = '\0';
+
+      /* ... and append search pattern to it */
+      p = strchr (dirp->patt, '\0');
+      if (dirp->patt < p  &&  *(p-1) != '\\'  &&  *(p-1) != ':') {
+         *p++ = '\\';
+      }
+      *p++ = '*';
+      *p = '\0';
+
+      /* open stream and retrieve first file */
+      dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
+      if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+         /* invalid search pattern? */
+         free (dirp);
+         return NULL;
+      }
+
+      /* there is an un-processed directory entry in memory now */
+      dirp->cached = 1;
+   }
+
+   return dirp;
+}
+
+
+/*****************************************************************************
+ * Read a directory entry, and return a pointer to a dirent structure
+ * containing the name of the entry in d_name field.  Individual directory
+ * entries returned by this very function include regular files,
+ * sub-directories, pseudo-directories "." and "..", but also volume labels,
+ * hidden files and system files may be returned.
+ */
+static struct dirent *readdir(DIR *dirp)
+{
+   assert (dirp != NULL);
+
+   if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+      /* directory stream was opened/rewound incorrectly or ended normally */
+      return NULL;
+   }
+
+   /* get next directory entry */
+   if (dirp->cached != 0) {
+      /* a valid directory entry already in memory */
+      dirp->cached = 0;
+   } else {
+      /* read next directory entry from disk */
+      if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) {
+         /* the very last file has been processed or an error occured */
+         FindClose (dirp->search_handle);
+         dirp->search_handle = INVALID_HANDLE_VALUE;
+         return NULL;
+      }
+   }
+
+   /* copy as a multibyte character string */
+   STRNCPY ( dirp->current.d_name,
+             dirp->current.data.cFileName,
+             sizeof(dirp->current.d_name) );
+   dirp->current.d_name[MAX_PATH] = '\0';
+
+   return &dirp->current;
+}
+
+
+/*****************************************************************************
+ * Close directory stream opened by opendir() function.  Close of the
+ * directory stream invalidates the DIR structure as well as any previously
+ * read directory entry.
+ */
+static int closedir(DIR *dirp)
+{
+   assert (dirp != NULL);
+
+   /* release search handle */
+   if (dirp->search_handle != INVALID_HANDLE_VALUE) {
+      FindClose (dirp->search_handle);
+      dirp->search_handle = INVALID_HANDLE_VALUE;
+   }
+
+   /* release directory handle */
+   free (dirp);
+   return 0;
+}
+
+
+/*****************************************************************************
+ * Resets the position of the directory stream to which dirp refers to the
+ * beginning of the directory. It also causes the directory stream to refer
+ * to the current state of the corresponding directory, as a call to opendir()
+ * would have done. If dirp does not refer to a directory stream, the effect
+ * is undefined.
+ */
+static void rewinddir(DIR* dirp)
+{
+   /* release search handle */
+   if (dirp->search_handle != INVALID_HANDLE_VALUE) {
+      FindClose (dirp->search_handle);
+      dirp->search_handle = INVALID_HANDLE_VALUE;
+   }
+
+   /* open new search handle and retrieve first file */
+   dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
+   if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+      /* invalid search pattern? */
+      free (dirp);
+      return;
+   }
+
+   /* there is an un-processed directory entry in memory now */
+   dirp->cached = 1;
+}
+
+
+#endif /*DIRENT_H*/
diff --git a/src/common/makefile.mak b/src/common/makefile.mak
new file mode 100644
index 00000000..ee046895
--- /dev/null
+++ b/src/common/makefile.mak
@@ -0,0 +1,13 @@
+include "..\makeinc.mak"
+
+all: $(COMMON_OBJECTS) xchatcommon.lib
+
+xchatcommon.lib: $(COMMON_OBJECTS)
+	lib -out:xchatcommon.lib $(COMMON_OBJECTS)
+
+.c.obj:
+	$(CC) $(CFLAGS) $(GLIB) $<
+
+clean:
+	del *.obj
+	del xchatcommon.lib
diff --git a/src/fe-gtk/makefile.mak b/src/fe-gtk/makefile.mak
new file mode 100644
index 00000000..3ce9cb5b
--- /dev/null
+++ b/src/fe-gtk/makefile.mak
@@ -0,0 +1,37 @@
+include "..\makeinc.mak"
+
+!ifdef X64
+MACHINE_FLAG = /MACHINE:X64
+!else
+MACHINE_FLAG = /MACHINE:X86
+!endif
+
+COMLIB = ..\common\xchatcommon.lib
+PROG = xchat.exe
+
+all: $(PROG)
+
+mmx_cmod.o: mmx_cmod.S
+	gcc -DUNDERSCORE_SYMBOLS -c mmx_cmod.S
+
+.c.obj:
+	$(CC) $(CFLAGS) $(GLIB) $(GTK) $<
+
+$(PROG): $(FEGTK_OBJECTS) $(COMLIB) xchat-icon.obj
+	$(LINK) /out:$(PROG) /ENTRY:mainCRTStartup $(LDFLAGS) $(LIBS) $(FEGTK_OBJECTS) $(COMLIB) xchat-icon.obj
+	@dir $(PROG)
+
+xchat.rc:
+	echo XC_ICON ICON "../../xchat.ico" > xchat.rc
+
+xchat.res: xchat.rc ../../xchat.ico
+	rc /r xchat.rc
+
+xchat-icon.obj: xchat.res
+	cvtres /NOLOGO $(MACHINE_FLAG) /OUT:xchat-icon.obj xchat.res
+
+clean:
+	del *.obj
+	del $(PROG)
+	del xchat.rc
+	del xchat.RES
diff --git a/src/makefile.mak b/src/makefile.mak
new file mode 100644
index 00000000..89f897d7
--- /dev/null
+++ b/src/makefile.mak
@@ -0,0 +1,18 @@
+all:
+	copy ..\plugins\xchat-plugin.h common
+	@cd pixmaps
+	@-$(MAKE) -f makefile.mak $@
+	@cd ..\common
+	@-$(MAKE) -f makefile.mak $@
+	@cd ..\fe-gtk
+	@-$(MAKE) -f makefile.mak $@
+
+clean:
+	del common\*.obj
+	del common\xchatcommon.lib
+	del fe-gtk\*.obj
+	del fe-gtk\mmx_cmod.o
+	del fe-gtk\xchat.exe
+	del fe-gtk\xchat.rc
+	del fe-gtk\xchat.RES
+	del pixmaps\*.h
diff --git a/src/makeinc.mak b/src/makeinc.mak
new file mode 100644
index 00000000..512c2f85
--- /dev/null
+++ b/src/makeinc.mak
@@ -0,0 +1,125 @@
+#uncomment this to have an x64 build
+#X64 = YES
+#OPENSSL = YES
+IPV6 = YES
+
+CC = cl
+LINK = link
+CFLAGS = $(CFLAGS) /Ox /c /MD /nologo /DWIN32 /DG_DISABLE_CAST_CHECKS /Dstrcasecmp=stricmp /Dstrncasecmp=strnicmp /Dstrtoull=_strtoui64
+CPPFLAGS = /c /MD /nologo /DWIN32
+LDFLAGS = /subsystem:windows /nologo
+LIBS = $(LIBS) gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.lib winmm.lib
+!ifdef X64
+#############################################################
+#x64 config
+GLIB = -Ic:/mozilla-build/build/xchat-dev64/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/glib-2.0/include
+GTK = -Ic:/mozilla-build/build/xchat-dev64/include/gtk-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/gtk-2.0/include -Ic:/mozilla-build/build/xchat-dev64/include/atk-1.0 -Ic:/mozilla-build/build/xchat-dev64/include/cairo -Ic:/mozilla-build/build/xchat-dev64/include/pango-1.0 -Ic:/mozilla-build/build/xchat-dev64/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/glib-2.0/include -Ic:/mozilla-build/build/xchat-dev64/include/freetype2 -Ic:/mozilla-build/build/xchat-dev64/include -Ic:/mozilla-build/build/xchat-dev64/include/libpng14
+LIBS = $(LIBS) /libpath:c:/mozilla-build/build/xchat-dev64/lib gtk-win32-2.0.lib gdk-win32-2.0.lib atk-1.0.lib gio-2.0.lib gdk_pixbuf-2.0.lib pangowin32-1.0.lib gdi32.lib pangocairo-1.0.lib pango-1.0.lib cairo.lib gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib intl.lib
+
+CFLAGS = $(CFLAGS) /favor:AMD64
+CPPFLAGS = $(CPPFLAGS) /favor:AMD64 /D_WIN64
+LDFLAGS = $(LDFLAGS) msvcrt_win2003.obj
+
+PERLPATH = c:\mozilla-build\perl-5.10-x64\lib\CORE
+PYTHONPATH = c:\mozilla-build\python-2.5-x64
+TCLPATH = c:\mozilla-build\tcl-8.6-x64
+!else
+#############################################################
+#x86 config
+GLIB = -Ic:/mozilla-build/build/xchat-dev32/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/glib-2.0/include
+GTK = -Ic:/mozilla-build/build/xchat-dev32/include/gtk-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/gtk-2.0/include -Ic:/mozilla-build/build/xchat-dev32/include/atk-1.0 -Ic:/mozilla-build/build/xchat-dev32/include/cairo -Ic:/mozilla-build/build/xchat-dev32/include/pango-1.0 -Ic:/mozilla-build/build/xchat-dev32/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/glib-2.0/include -Ic:/mozilla-build/build/xchat-dev32/include/freetype2 -Ic:/mozilla-build/build/xchat-dev32/include -Ic:/mozilla-build/build/xchat-dev32/include/libpng14
+LIBS = $(LIBS) /libpath:c:/mozilla-build/build/xchat-dev32/lib gtk-win32-2.0.lib gdk-win32-2.0.lib atk-1.0.lib gio-2.0.lib gdk_pixbuf-2.0.lib pangowin32-1.0.lib gdi32.lib pangocairo-1.0.lib pango-1.0.lib cairo.lib gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib intl.lib
+
+LDFLAGS = $(LDFLAGS) msvcrt_winxp.obj
+
+PERLPATH = c:\mozilla-build\perl-5.10-x86\lib\CORE
+PYTHONPATH = c:\mozilla-build\python-2.5-x86
+TCLPATH = c:\mozilla-build\tcl-8.6-x86
+
+MMX = YES
+!endif
+#############################################################
+
+PERLLIB = perl510
+PERLOUTPUT = xcperl.dll
+
+PYTHONLIB = python25
+PYTHONOUTPUT = xcpython.dll
+
+TCLLIB = tcl86
+TCLOUTPUT = xctcl.dll
+
+!ifdef IPV6
+CFLAGS = $(CFLAGS) -DUSE_IPV6
+LIBS = $(LIBS) ws2_32.lib
+!else
+LIBS = $(LIBS) wsock32.lib
+!endif
+
+!ifdef OPENSSL
+CFLAGS = $(CFLAGS) /DUSE_OPENSSL
+LIBS = $(LIBS) libeay32.lib ssleay32.lib
+SSLOBJ = ssl.obj
+!endif
+
+COMMON_OBJECTS = \
+cfgfiles.obj \
+chanopt.obj \
+ctcp.obj \
+dcc.obj \
+history.obj \
+identd.obj \
+ignore.obj \
+inbound.obj \
+modes.obj \
+network.obj \
+notify.obj \
+outbound.obj \
+plugin.obj \
+plugin-timer.obj \
+proto-irc.obj \
+server.obj \
+servlist.obj \
+$(SSLOBJ) \
+text.obj \
+tree.obj \
+url.obj \
+userlist.obj \
+util.obj \
+xchat.obj
+
+FEGTK_OBJECTS = \
+about.obj \
+ascii.obj \
+banlist.obj \
+chanlist.obj \
+chanview.obj \
+custom-list.obj \
+dccgui.obj \
+editlist.obj \
+fe-gtk.obj \
+fkeys.obj \
+gtkutil.obj \
+ignoregui.obj \
+joind.obj \
+maingui.obj \
+menu.obj \
+notifygui.obj \
+palette.obj \
+pixmaps.obj \
+plugingui.obj \
+plugin-tray.obj \
+rawlog.obj \
+search.obj \
+servlistgui.obj \
+setup.obj \
+sexy-spell-entry.obj \
+textgui.obj \
+urlgrab.obj \
+userlistgui.obj \
+xtext.obj
+
+!ifdef MMX
+FEGTK_OBJECTS = $(FEGTK_OBJECTS) mmx_cmod.o
+CFLAGS = $(CFLAGS) -DUSE_MMX
+!endif
diff --git a/src/pixmaps/makefile.mak b/src/pixmaps/makefile.mak
new file mode 100644
index 00000000..e113b591
--- /dev/null
+++ b/src/pixmaps/makefile.mak
@@ -0,0 +1,18 @@
+CONV = gdk-pixbuf-csource
+
+LIST =	bookpng book.png \
+			hoppng hop.png \
+			oppng op.png \
+			purplepng purple.png \
+			redpng red.png \
+			trayfilepng fileoffer.png \
+			trayhilightpng highlight.png \
+			traymsgpng message.png \
+			voicepng voice.png \
+			xchatpng ..\..\xchat.png
+
+all: 
+	$(CONV) --build-list $(LIST) > inline_pngs.h
+
+clean:
+	del *.h