changeset: 129:4745d39529c3
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Thu Jun 17 18:03:10 2010 -0400
files: include/ixp.h lib/libixp/convert.c man/IXP_ASSERT_VERSION.3 man/targets.mk util/grepdoc
description:
Add IXP_ASSERT_VERSION macro.
diff -r 15c2fe4e605f -r 4745d39529c3 include/ixp.h
--- a/include/ixp.h Wed Jun 16 17:28:37 2010 -0400
+++ b/include/ixp.h Thu Jun 17 18:03:10 2010 -0400
@@ -7,17 +7,49 @@
#include <sys/types.h>
#include <sys/select.h>
-#define IXP_API 127
+/**
+ * Macro: IXP_API
+ * Macro: IXP_NEEDAPI
+ * Macro: IXP_MAXAPI
+ * Macro: IXP_ASSERT_VERSION
+ *
+ * IXP_API contains the current libixp API revision number.
+ *
+ * IXP_NEEDAPI, if defined before ixp.h is included, directs the
+ * header to present an older version of the libixp API. This allows
+ * code written for older versions of libixp to compile against
+ * newer versions without modification. It does not, however, ensure
+ * that it will link against a different version of libixp than the
+ * ixp.h header belongs to.
+ *
+ * IXP_MAXAPI, if defined before ixp.h is included, prevents code
+ * from compiling with a newer version of libixp than specified.
+ *
+ * When inserted into any function, IXP_ASSERT_VERSION ensures that
+ * the resulting object will fail to link link against any version
+ * of libixp with a different API version than it was compiled
+ * against.
+ */
+#define IXP_API 129
+#ifndef IXP_NEEDAPI
+#define IXP_NEEDAPI IXP_API
+#endif
+#ifndef IXP_MAXAPI
+#define IXP_MAXAPI IXP_API
+#endif
+#define _IXP_ASSERT_VERSION ixp_version_##129##_required
+#define IXP_ASSERT_VERSION do _IXP_ASSERT_VERSION = 0; while(0)
+extern int _IXP_ASSERT_VERSION;
/* Gunk */
-#if defined(IXP_NEEDAPI) && IXP_API < IXP_NEEDAPI
+#if IXP_API < IXP_NEEDAPI
# error A newer version of libixp is needed for this compilation.
#endif
-#if defined(IXP_MAXAPI) && IXP_API > IXP_MAXAPI
+#if IXP_API > IXP_MAXAPI
# warning This version of libixp has a newer API than this compilation requires.
#endif
-#if defined(IXP_NEEDAPI) && IXP_NEEDAPI < 127
+#if IXP_NEEDAPI < 127
# undef ushort
# undef ulong
# undef vlong
@@ -372,7 +404,7 @@
IxpFHdr hdr;
IxpStat stat;
};
-#if defined(IXP_NEEDAPI) && IXP_NEEDAPI <= 89
+#if IXP_NEEDAPI <= 89
/* from fcall(3) in plan9port */
typedef struct IxpFcall IxpFcall; /* Deprecated */
struct IxpFcall { /* Deprecated */
@@ -735,7 +767,7 @@
void ixp_respond(Ixp9Req*, const char *err);
void ixp_serve9conn(IxpConn*);
-#if defined(IXP_NEEDAPI) && IXP_NEEDAPI < 127
+#if IXP_NEEDAPI < 127
# define respond ixp_respond
# define serve_9pcon ixp_serve9pconn
#endif
diff -r 15c2fe4e605f -r 4745d39529c3 lib/libixp/convert.c
--- a/lib/libixp/convert.c Wed Jun 16 17:28:37 2010 -0400
+++ b/lib/libixp/convert.c Thu Jun 17 18:03:10 2010 -0400
@@ -6,6 +6,8 @@
#include <string.h>
#include "ixp_local.h"
+int _IXP_ASSERT_VERSION;
+
enum {
SByte = 1,
SWord = 2,
diff -r 15c2fe4e605f -r 4745d39529c3 man/IXP_ASSERT_VERSION.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/man/IXP_ASSERT_VERSION.3 Thu Jun 17 18:03:10 2010 -0400
@@ -0,0 +1,23 @@
+.TH "IXP_ASSERT_VERSION" 3 "2010 Jun" "libixp Manual"
+
+.SH NAME
+.P
+IXP_ASSERT_VERSION
+
+.SH SYNOPSIS
+.nf
+ #include <ixp.h>
+
+ #define IXP_ASSERT_VERSION ...
+.fi
+
+.SH DESCRIPTION
+.P
+When inserted into any function, this macro ensures that the
+object will fail to link link against any version of libixp with
+a different API version than it was compiled against.
+
+
+.\" man code generated by txt2tags 2.5 (http://txt2tags.sf.net)
+.\" cmdline: txt2tags -o- IXP_ASSERT_VERSION.man3
+
diff -r 15c2fe4e605f -r 4745d39529c3 man/targets.mk
--- a/man/targets.mk Wed Jun 16 17:28:37 2010 -0400
+++ b/man/targets.mk Thu Jun 17 18:03:10 2010 -0400
@@ -1,4 +1,5 @@
MANPAGES = \
+ 'IXP_API.3 IXP_NEEDAPI.3 IXP_MAXAPI.3 IXP_ASSERT_VERSION.3' \
'IxpFcall.3 IxpFType.3 IxpFAttach.3 IxpFError.3 IxpFHdr.3 IxpFIO.3 IxpFRAuth.3 IxpFROpen.3 IxpFRStat.3 IxpFRWalk.3 IxpFTCreate.3 IxpFTFlush.3 IxpFTWStat.3 IxpFTWalk.3 IxpFVersion.3' \
'IxpFid.3' \
'IxpThread.3 IxpMutex.3 IxpRWLock.3 IxpRendez.3 ixp_thread.3' \
diff -r 15c2fe4e605f -r 4745d39529c3 util/grepdoc
--- a/util/grepdoc Wed Jun 16 17:28:37 2010 -0400
+++ b/util/grepdoc Thu Jun 17 18:03:10 2010 -0400
@@ -56,6 +56,10 @@
$headers{$1} = $f;
push @{$protos{$1}}, $& unless $& =~ m{\Q/* Deprecated */};
}
+ while(m/^\s*#\s*define\s+(\w+)((?:\(.*?\))?)/gm) {
+ $headers{$1} = $f;
+ push @{$protos{$1}}, "#define $1$2 ...";
+ }
while(m/^(?:enum|struct|union)\s+(\w+).*?^\}/gsm) {
$headers{$1} = $f;
my $proto = \@{$protos{$1}};
@@ -89,7 +93,7 @@
s{^(\w+:.*?)\n\n}{
$header = $1;
- $header =~ s{^(?:Function|Type|Variable): (\w+)}{
+ $header =~ s{^(?:Function|Type|Variable|Macro): (\w+)}{
push @names, $1;
join("\n", @{$protos{$1} or [$1]}) . "\n"
}gem;
Received on Thu Jun 17 2010 - 22:23:12 UTC
This archive was generated by hypermail 2.2.0 : Thu Jun 17 2010 - 22:24:04 UTC