Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses curses: Add __NetBSD_Curses_Version__
details: https://anonhg.NetBSD.org/src/rev/d934b9d3d328
branches: trunk
changeset: 459302:d934b9d3d328
user: roy <roy%NetBSD.org@localhost>
date: Tue Sep 03 10:36:17 2019 +0000
description:
curses: Add __NetBSD_Curses_Version__
Similar to __NetBSD_Version__ from sys/param.h but has no
correlation to it or the ELF symver libcurses is built as.
If we say that v1 was everything prior to this, it makes sense to
start this from v2.
diffstat:
lib/libcurses/Makefile | 8 ++---
lib/libcurses/curses.h | 19 ++++++++++++-
lib/libcurses/cursesrelease.sh | 59 ++++++++++++++++++++++++++++++++++++++++++
lib/libcurses/version.c | 6 ++--
4 files changed, 83 insertions(+), 9 deletions(-)
diffs (143 lines):
diff -r 1b4af5813e15 -r d934b9d3d328 lib/libcurses/Makefile
--- a/lib/libcurses/Makefile Tue Sep 03 03:04:31 2019 +0000
+++ b/lib/libcurses/Makefile Tue Sep 03 10:36:17 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.91 2019/09/02 09:08:29 roy Exp $
+# $NetBSD: Makefile,v 1.92 2019/09/03 10:36:17 roy Exp $
# @(#)Makefile 8.2 (Berkeley) 1/2/94
.include <bsd.own.mk>
@@ -210,10 +210,8 @@
fileio.h: shlib_version genfileioh.awk
${TOOL_AWK} -f ${.CURDIR}/genfileioh.awk < ${.CURDIR}/shlib_version > ${.CURDIR}/fileio.h
-NETBSD_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
-CPPFLAGS.version.c+= -DNETBSD_VERSION=\"${NETBSD_VERSION}\"
-.PATH: ${NETBSDSRCDIR}/sys/sys
-version.o: param.h
+CURSES_VERSION!= ${HOST_SH} ${.CURDIR}/cursesrelease.sh
+CPPFLAGS.version.c+= -DCURSES_VERSION=\"${CURSES_VERSION}\"
.include <bsd.lib.mk>
.include <bsd.subdir.mk>
diff -r 1b4af5813e15 -r d934b9d3d328 lib/libcurses/curses.h
--- a/lib/libcurses/curses.h Tue Sep 03 03:04:31 2019 +0000
+++ b/lib/libcurses/curses.h Tue Sep 03 10:36:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses.h,v 1.124 2019/09/02 09:08:29 roy Exp $ */
+/* $NetBSD: curses.h,v 1.125 2019/09/03 10:36:17 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -48,6 +48,23 @@
#include <stdbool.h>
/*
+ * #define __NetBSD_Curses_Version__ MMmmrrpp00
+ *
+ * M = major version
+ * m = minor version; a minor number of 99 indicates current
+ * r = 0 (*)
+ * p = patchlevel
+ *
+ * This is similar to __NetBSD_Version__ as found in sys/param.h
+ * It is maintained seperately and has no correlation to it or the
+ * ELF symver libcurses is built as.
+ */
+#define __NetBSD_Curses_Version__ 0200000000 /* NetBSD-Curses 2.0.0 */
+
+#define __NetBSD_Curses_Prereq__(M,m,p) (((((M) * 100000000) + \
+ (m) * 1000000) + (p) * 100) <= __NetBSD_Curses_Version__)
+
+/*
* attr_t must be the same size as wchar_t (see <wchar.h>) to avoid padding
* in __LDATA.
*/
diff -r 1b4af5813e15 -r d934b9d3d328 lib/libcurses/cursesrelease.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libcurses/cursesrelease.sh Tue Sep 03 10:36:17 2019 +0000
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# $NetBSD: cursesrelease.sh,v 1.1 2019/09/03 10:36:17 roy Exp $
+#
+# Copyright (c) 1997 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Luke Mewburn.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+# We use the number specified in <curses.h>
+
+path="$0"
+[ "${path#/*}" = "$path" ] && path="./$path"
+exec < ${path%/*}/curses.h
+
+# Search for line
+# #define __NetBSD_Curses_Version__ <ver_num> /* NetBSD-Curses <ver_text> */
+#
+# <ver_num> and <ver_text> should match!
+
+while
+ read define ver_tag rel_num comment_start NetBSD rel_text rest || exit 1
+do
+ [ "$define" = "#define" ] || continue;
+ [ "$ver_tag" = "__NetBSD_Curses_Version__" ] || continue
+ break
+done
+
+# ${rel_num} is [M]Mmm00pp00
+rel_num=${rel_num%??}
+rel_MMmm=${rel_num%????}
+rel_MM=${rel_MMmm%??}
+rel_mm=${rel_MMmm#${rel_MM}}
+rel_pp=${rel_num#${rel_MMmm}00}
+
+echo "${rel_MM#0}.${rel_mm#0}.${rel_pp#0}"
diff -r 1b4af5813e15 -r d934b9d3d328 lib/libcurses/version.c
--- a/lib/libcurses/version.c Tue Sep 03 03:04:31 2019 +0000
+++ b/lib/libcurses/version.c Tue Sep 03 10:36:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $ */
+/* $NetBSD: version.c,v 1.2 2019/09/03 10:36:17 roy Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $");
+__RCSID("$NetBSD: version.c,v 1.2 2019/09/03 10:36:17 roy Exp $");
#endif
#include "curses.h"
@@ -40,5 +40,5 @@
curses_version()
{
- return "NetBSD-Curses " NETBSD_VERSION;
+ return "NetBSD-Curses " CURSES_VERSION;
}
Home |
Main Index |
Thread Index |
Old Index