Glib 1.2.8 for OpenVMS



Hi,

I recently tried to 'port' glib to OpenVMS platform and succeeded.
During the
process I made some changes to the sources and I want make them
available to
everyone else in the spirit of free software exchange. I think that
these
changes can be incorporated in the next version of glib.

The OpenVMS system I used is version 7.1-2 using the Compaq C++
compiler. This
compiler, as most c++ compiler is more strict on type checking than the
regular c compilers. Therefore, most of the changes I had to make are
typecastings.

I've attached the zip file with differences to the glib C sources, the
glibconfig.h file for OpenVMS together and the .mms (Makefile
equivalent).

The bad news : one thing that doesn't work yet is the gmodule. The calls
(dlopen, dlsym, ...) are available on OpenVMS but I'm still trying to
figure
out why they won't work. As soon as I found the problem(s), I'll post
the
fixes, workarounds and other tricks.
The good news : everything else (including multithreading) works


Overview of the changed sources :
garray.c
--------
added a couple of type castings.

gcache.c
--------
type castings

gcompletion.c
-------------
no changes

gdataset.c
----------
type casting

gdate.c
-------
Mostly type castings for weekday and month values.
1 unreachable statement
The function g_date_fill_parse_tokens() assigns a gchar * to an guchar
*. The
compiler complains about it but maybe this was done intentionally ? I'm
not
quite sure of the effect of the change I made on other platforms.

gerror.c
--------
Added ifdef's (for the same reason as the ifdef for native_win32).

ghash.c
-------
no changes.

ghook.c
-------
no changes.

giochannel.c
------------
no changes.

giounix.c
---------
type castings.

glist.c
-------
type castings

gmain.c
-------
type castings.

gmessages.c
-----------
Mostly type casting. Had to rewrite a couple of statements because of
that.

gmutex.c
--------
type casting.

gnode.c
-------
type casting

gprimes.c
---------
no changes

grel.c
------
type casting

gslist.c
--------
type casting

gstrfuncs.c
-----------
type casting

gstring.c
---------
type casting

gthread-posix.c
---------------
no changes

gthread.c
---------
no changes

gtimer.c
--------
no changes

gtree.c
-------
no changes

testgdate.c
-----------
more type casts

testgdateparser.c
-----------------
no changes

testglib.c
----------
more typecasts
gtree.c
-------
no changes

testgdate.c
-----------
more type casts

testgdateparser.c
-----------------
no changes

testglib.c
----------
more typecasts

Hope this helps some other programmers on OpenVMS.

Marc.

changes.zip

/*  CMS REPLACEMENT HISTORY, Element GLIBCONFIG.H */
/*  *1    27-JAN-2000 16:48:29 Q053870 "GLIB - usefull functions and definitions" */
/*  CMS REPLACEMENT HISTORY, Element GLIBCONFIG.H */
/* glibconfig.h.vms */
/* Handcrafted for VMS */

#ifndef GLIBCONFIG_H
#define GLIBCONFIG_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <limits.h>
#include <float.h>
#include <processes.h>
#include <unixlib.h>

#include "config.h"
#include <unistd.h>

#define SIZEOF_LONG	4

#define G_MINFLOAT	FLT_MIN
#define G_MAXFLOAT	FLT_MAX
#define G_MINDOUBLE	DBL_MIN
#define G_MAXDOUBLE	DBL_MAX
#define G_MINSHORT	SHRT_MIN
#define G_MAXSHORT	SHRT_MAX
#define G_MININT	INT_MIN
#define G_MAXINT	INT_MAX
#define G_MINLONG	LONG_MIN
#define G_MAXLONG	LONG_MAX

typedef signed char gint8;
typedef unsigned char guint8;
typedef signed short gint16;
typedef unsigned short guint16;
typedef signed int gint32;
typedef unsigned int guint32;

#define G_HAVE_GINT64

typedef __int64 gint64;
typedef unsigned __int64 guint64;

#define G_GINT64_CONSTANT(val)	(val) /*(val##i64)*/

#define GPOINTER_TO_INT(p)	((gint)(p))
#define GPOINTER_TO_UINT(p)	((guint)(p))

#define GINT_TO_POINTER(i)	((gpointer)(i))
#define GUINT_TO_POINTER(u)	((gpointer)(u))

#define g_ATEXIT(proc)	(atexit (proc))

#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END

#define G_HAVE_ALLOCA 1
#define alloca __ALLOCA

#define GLIB_MAJOR_VERSION 1
#define GLIB_MINOR_VERSION 2
#define GLIB_MICRO_VERSION 8

#ifdef	__cplusplus
#define	G_HAVE_INLINE	1
#else	/* !__cplusplus */
#define G_HAVE___INLINE 1
#endif

#define HAVE_PTHREAD_COND_TIMEDWAIT_POSIX 1
#define G_THREADS_ENABLED
/*
 * The following program can be used to determine the magic values below:
 * #include <stdio.h>
 * #include <pthread.h>
 * main(int argc, char **argv)
 * {
 *   int i;
 *   pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
 *   printf ("sizeof (pthread_mutex_t) = %d\n", sizeof (pthread_mutex_t));
 *   printf ("PTHREAD_MUTEX_INITIALIZER = ");
 *   for (i = 0; i < sizeof (pthread_mutex_t); i++)
 *     printf ("%u, ", (unsigned) ((char *) &m)[i]);
 *   printf ("\n");
 *   exit(0);
 * }
 */

typedef struct _GStaticMutex GStaticMutex;
struct _GStaticMutex
{
  struct _GMutex *runtime_mutex;
  union {
    /* The size of the pad array should be sizeof (pthread_mutext_t) */
    /* This value corresponds to the 1999-01-24 version of pthreads-win32 */
    unsigned char   pad[36];
    double dummy_double;
    void  *dummy_pointer;
    long   dummy_long;
  } aligned_pad_u;
};
/* This should be NULL followed by the bytes in PTHREAD_MUTEX_INITIALIZER */
/*
{ 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
*/
#define	G_STATIC_MUTEX_INIT	{ NULL, { \
{ 0, 0, 32, 0, 225, 175, 188, 13, 0, 0, \
  0, 0,  0, 0,   0,   0,   0,  0, 0, 0, \
  0, 0,  0, 0,   0,   0,   0,  0, 0, 0, \
  0, 0,  0, 0,   0,   0    } \
} }
#define	g_static_mutex_get_mutex(mutex) \
  (g_thread_use_default_impl ? ((GMutex*) &((mutex)->aligned_pad_u)) : \
   g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex)))

#define G_BYTE_ORDER G_LITTLE_ENDIAN

#define GINT16_TO_LE(val)	((gint16) (val))
#define GUINT16_TO_LE(val)	((guint16) (val))
#define GINT16_TO_BE(val)	((gint16) GUINT16_SWAP_LE_BE (val))
#define GUINT16_TO_BE(val)	(GUINT16_SWAP_LE_BE (val))

#define GINT32_TO_LE(val)	((gint32) (val))
#define GUINT32_TO_LE(val)	((guint32) (val))
#define GINT32_TO_BE(val)	((gint32) GUINT32_SWAP_LE_BE (val))
#define GUINT32_TO_BE(val)	(GUINT32_SWAP_LE_BE (val))

#define GINT64_TO_LE(val)	((gint64) (val))
#define GUINT64_TO_LE(val)	((guint64) (val))
#define GINT64_TO_BE(val)	((gint64) GUINT64_SWAP_LE_BE (val))
#define GUINT64_TO_BE(val)	(GUINT64_SWAP_LE_BE (val))

#define GLONG_TO_LE(val)	((glong) GINT32_TO_LE (val))
#define GULONG_TO_LE(val)	((gulong) GUINT32_TO_LE (val))
#define GLONG_TO_BE(val)	((glong) GINT32_TO_BE (val))
#define GULONG_TO_BE(val)	((gulong) GUINT32_TO_BE (val))

#define GINT_TO_LE(val)		((gint) GINT32_TO_LE (val))
#define GUINT_TO_LE(val)	((guint) GUINT32_TO_LE (val))
#define GINT_TO_BE(val)		((gint) GINT32_TO_BE (val))
#define GUINT_TO_BE(val)	((guint) GUINT32_TO_BE (val))

#define GLIB_SYSDEF_POLLIN	= 1
#define GLIB_SYSDEF_POLLOUT	= 4
#define GLIB_SYSDEF_POLLPRI	= 2
#define GLIB_SYSDEF_POLLERR	= 8
#define GLIB_SYSDEF_POLLHUP	= 16
#define GLIB_SYSDEF_POLLNVAL	= 32

#define G_HAVE_WCHAR_H 1
#define G_HAVE_WCTYPE_H 1

#define g_source_remove_by_funcs_user_data g_source_rem_by_funcs_usr_data
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* GLIBCONFIG_H */
#  CMS REPLACEMENT HISTORY, Element GLIB.MMS
#  *1    27-JAN-2000 16:48:18 Q053870 "GLIB - usefull functions and definitions"
#  CMS REPLACEMENT HISTORY, Element GLIB.MMS
#
#  Makefile for glib
#
MAKEFILE=descrip.mms

.SUFFIXES :
.SUFFIXES : .olb .obj .c

CC = cxx/ -
    warnings=(info,disable=(ARGLISGTR255,MISALGNDSTRCT,UNRFUNPRM,MISALGNDMEM,BOOLEXPRCONST,EXPRHASNOEFFECT,UNDPREID,CODEUNREACHABLE))/error=2 

CFLAGS=/debug/noopt/prefix_library_entries=all_entries

.c.obj :
	$(CC) $(INCLUDES) $(CDEFS) $(CFLAGS) $(MMS$SOURCE)

LIBR = lib
#
# Definitions to insert .obj's into .olb
#
.OBJ.OLB :
	if "''f$search("$(MMS$TARGET)")'" .eqs. "" -
	  then $(LIBR)/CREATE $(MMS$TARGET)
	$(LIBR) $(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE)

OBJS = GARRAY \
GCACHE        \
GCOMPLETION   \
GDATASET      \
GDATE         \
GERROR        \
GHASH         \
GHOOK         \
GIOCHANNEL    \
GIOUNIX       \
GLIST         \
GMAIN         \
GMEM          \
GMESSAGES     \
GMUTEX        \
GNODE         \
GPRIMES       \
GREL          \
GSCANNER      \
GSLIST        \
GSTRING       \
GSTRFUNCS     \
GTIMER        \
GTREE         \
GTHREAD       \
GUTILS

test : testglib.exe testgdate.exe testgdateparser.exe
	continue

testgdate.exe : testgdate.obj local.olb
	cxxlink/debug testgdate,local/lib,pthreads/opt

testgdateparser.exe : testgdateparser.obj local.olb
	cxxlink/debug testgdateparser,local/lib,pthreads/opt

testglib.exe : testglib.obj local.olb
	cxxlink/debug testglib,local/lib,pthreads/opt

local.olb : local.olb( $(OBJS) )
	continue

depend :
	makedepend -f$(MAKEFILE) *.c
# DO NOT DELETE THIS LINE -- make depend depends on it.

garray.obj : garray.c glib.h glibconfig.h config.h
gcache.obj : gcache.c glib.h glibconfig.h config.h
gcompletion.obj : gcompletion.c glib.h glibconfig.h config.h
gdataset.obj : gdataset.c glib.h glibconfig.h config.h
gdate.obj : gdate.c glib.h glibconfig.h config.h
gerror.obj : gerror.c glib.h glibconfig.h config.h
ghash.obj : ghash.c glib.h glibconfig.h config.h
ghook.obj : ghook.c glib.h glibconfig.h config.h
giochannel.obj : giochannel.c config.h glib.h glibconfig.h
giounix.obj : giounix.c glib.h glibconfig.h config.h
giowin32.obj : giowin32.c config.h glib.h glibconfig.h
glist.obj : glist.c glib.h glibconfig.h config.h
gmain.obj : gmain.c config.h glib.h glibconfig.h
gmem.obj : gmem.c glib.h glibconfig.h config.h
gmessages.obj : gmessages.c glib.h glibconfig.h config.h
gmutex.obj : gmutex.c glib.h glibconfig.h config.h
gnode.obj : gnode.c glib.h glibconfig.h config.h
gprimes.obj : gprimes.c glib.h glibconfig.h config.h
grel.obj : grel.c glib.h glibconfig.h config.h
gscanner.obj : gscanner.c glib.h glibconfig.h config.h
gslist.obj : gslist.c glib.h glibconfig.h config.h
gstrfuncs.obj : gstrfuncs.c glib.h glibconfig.h config.h
gstring.obj : gstring.c glib.h glibconfig.h config.h
gtimer.obj : gtimer.c glib.h glibconfig.h config.h
gtree.obj : gtree.c glib.h glibconfig.h config.h
gutils.obj : gutils.c glibconfig.h config.h glib.h
testgdate.obj : testgdate.c glib.h glibconfig.h config.h
testgdateparser.obj : testgdateparser.c glib.h glibconfig.h config.h
testglib.obj : testglib.c glib.h glibconfig.h config.h


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]