summaryrefslogtreecommitdiff
path: root/flower
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>1997-04-07 22:44:56 +0200
committerHan-Wen Nienhuys <hanwen@xs4all.nl>1997-04-07 22:44:56 +0200
commit79511c44a27908a1beaed25bbcac8d95a8a6b7c8 (patch)
tree5905709b4efda8df47ccec37713912678208ccbe /flower
parent1ca7a2c01e48a2585ab7b43aa18c9c276d4a05d0 (diff)
release: 0.0.49
Diffstat (limited to 'flower')
-rw-r--r--flower/.version2
-rw-r--r--flower/Makefile6
-rw-r--r--flower/NEWS4
-rw-r--r--flower/TODO5
-rw-r--r--flower/config.hh.in3
-rwxr-xr-xflower/configure3
-rw-r--r--flower/configure.in4
-rw-r--r--flower/dstream.cc6
-rw-r--r--flower/include/assoc.hh14
-rw-r--r--flower/include/list.hh5
-rw-r--r--flower/include/list.tcc5
-rw-r--r--flower/include/plist.hh4
-rw-r--r--flower/include/plist.tcc5
-rw-r--r--flower/include/pointer.hh49
-rw-r--r--flower/include/pointer.tcc88
-rw-r--r--flower/lgetopt.cc3
-rw-r--r--flower/test/Makefile30
17 files changed, 180 insertions, 56 deletions
diff --git a/flower/.version b/flower/.version
index ddcbb111b9..53a4af6a08 100644
--- a/flower/.version
+++ b/flower/.version
@@ -1,6 +1,6 @@
MAJOR_VERSION = 1
MINOR_VERSION = 1
-PATCH_LEVEL = 10
+PATCH_LEVEL = 11
# use to send patches, always empty for released version:
MY_PATCH_LEVEL = # include separator: "-1" or ".a"
#
diff --git a/flower/Makefile b/flower/Makefile
index 6272c5f509..0a6d806a21 100644
--- a/flower/Makefile
+++ b/flower/Makefile
@@ -48,9 +48,11 @@ EXTRA_DISTFILES= configure config.hh.in configure.in .version $(README_FILES) $(
include ./$(depth)/make/Targets.make
include ./$(depth)/make/Rules.make
#
-default: shared-lib
-shared-lib: $(SHAREDLIBRARY)
+default: the-lib
+
+THE_LIB=$(outdir)/$(LIB_PREFIX)flower$(LIB_SUFFIX)
+the-lib: $(THE_LIB)
# version:
#
diff --git a/flower/NEWS b/flower/NEWS
index 629d06e5dd..1f489e042f 100644
--- a/flower/NEWS
+++ b/flower/NEWS
@@ -1,3 +1,7 @@
+pl 1.1.11
+ - template<> class P
+ - assoc elem() methods
+
pl 1.1.10
- Matrix_storage naming
- Matrix_storage::try_right_multiply to help speed up
diff --git a/flower/TODO b/flower/TODO
index a0188c47f8..3e10b2b3af 100644
--- a/flower/TODO
+++ b/flower/TODO
@@ -1,10 +1,6 @@
- * Autoconf configure script.
-
* fix/junk ambiguous String constructor overloads, e.g.:
String( int ) and String( char )
- * shared lib.
-
* LGPL?
* disable this auto conv: const pointer -> bool -> string
@@ -24,3 +20,4 @@
parsestream.h
vector.h
+ * lgetopt: cmd -, or cmd --
diff --git a/flower/config.hh.in b/flower/config.hh.in
index 8747c8ffe4..9f3b982114 100644
--- a/flower/config.hh.in
+++ b/flower/config.hh.in
@@ -3,6 +3,3 @@
/* define if you have snprintf */
#define HAVE_SNPRINTF 0
-
-/* just testing */
-#define HAVE_FOOBAR 0
diff --git a/flower/configure b/flower/configure
index cba7a2f206..2a28860b95 100755
--- a/flower/configure
+++ b/flower/configure
@@ -531,7 +531,7 @@ cross_compiling=$ac_cv_prog_cxx_cross
optimise_b=yes
-shared_b=yes
+shared_b=no
LIB_SUFFIX=.a
# Check whether --enable-shared or --disable-shared was given.
@@ -1249,3 +1249,4 @@ chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/flower/configure.in b/flower/configure.in
index d35ff32bdd..e58f93f485 100644
--- a/flower/configure.in
+++ b/flower/configure.in
@@ -4,7 +4,7 @@ AC_INIT(choleski.cc)
AC_LANG_CPLUSPLUS
optimise_b=yes
-shared_b=yes
+shared_b=no
LIB_SUFFIX=.a
AC_ARG_ENABLE(shared,
@@ -25,7 +25,6 @@ if test $optimise_b = yes; then
MODULE_CXXFLAGS="$MODULE_CXXFLAGS -O2 -DSTRING_UTILS_INLINED"
fi
-dnl should enable flower specific compile flags.
AC_SUBST(MODULE_CXXFLAGS)
AC_SUBST(MODULE_LDFLAGS)
AC_SUBST(LIB_SUFFIX)
@@ -39,3 +38,4 @@ AC_CONFIG_HEADER(out/config.hh:config.hh.in)
CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
AC_OUTPUT(out/Flower-flags.make:Flower-flags.make.in)
+
diff --git a/flower/dstream.cc b/flower/dstream.cc
index 05ee3e6958..73416a4e46 100644
--- a/flower/dstream.cc
+++ b/flower/dstream.cc
@@ -45,9 +45,9 @@ Dstream::identify_as(String name)
String cl(strip_member(mem));
String idx = cl;
- if (silent->elt_query(mem))
+ if (silent->elt_b(mem))
idx = mem;
- else if (silent->elt_query(cl))
+ else if (silent->elt_b(cl))
idx = cl;
else {
(*silent)[idx] = false;
@@ -64,7 +64,7 @@ Dstream::identify_as(String name)
bool
Dstream::silence(String s)
{
- if (!silent->elt_query(s))
+ if (!silent->elt_b(s))
return false;
return (*silent)[s];
}
diff --git a/flower/include/assoc.hh b/flower/include/assoc.hh
index bf22881d90..b40d68661f 100644
--- a/flower/include/assoc.hh
+++ b/flower/include/assoc.hh
@@ -53,11 +53,11 @@ struct Assoc {
return arr.size() -1;
}
public:
- bool elt_query(K key) const {
+ bool elt_b(K key) const {
return find(key) >= 0;
}
void del(K key) {
- assert(elt_query(key));
+ assert(elt_b(key));
int i= find(key);
arr[i].free = true;
}
@@ -66,11 +66,17 @@ public:
int i = find_creat(key);
arr[i].val = val;
}
- V& operator[](K key) {
+ V& elem(K key) {
return arr[find_creat(key)].val;
+ }
+ V& operator[](K key) {
+ return elem(key);
}
V const & operator[](K key) const {
- assert(elt_query(key));
+ return elem(key);
+ }
+ V const & elem(K key) const {
+ assert(elt_b(key));
return arr[find(key)].val;
}
};
diff --git a/flower/include/list.hh b/flower/include/list.hh
index 1cfa9f54ed..a7389ed489 100644
--- a/flower/include/list.hh
+++ b/flower/include/list.hh
@@ -86,11 +86,6 @@ class List
#include "list.icc"
#include "cursor.hh"
-// instantiate a template: explicit instantiation.
-#define L_instantiate(a) template class List<a>; template class Cursor<a>; \
- template class Link<a>
-
-
#endif // __LIST_HH //
diff --git a/flower/include/list.tcc b/flower/include/list.tcc
index bd3a16b0c6..e3fa43cdd3 100644
--- a/flower/include/list.tcc
+++ b/flower/include/list.tcc
@@ -1,6 +1,11 @@
#ifndef LIST_CC
#define LIST_CC
+
+// instantiate a template: explicit instantiation.
+#define L_instantiate(a) template class List<a>; template class Cursor<a>; \
+ template class Link<a>
+
#include "list.hh"
template<class T>
diff --git a/flower/include/plist.hh b/flower/include/plist.hh
index 1fc4d941ab..80d780e3d6 100644
--- a/flower/include/plist.hh
+++ b/flower/include/plist.hh
@@ -62,10 +62,6 @@ template<class T>
void PL_copy(IPointerList<T*> &dst,IPointerList<T*> const&src);
-#define PL_instantiate(a) template class PointerList<a*>; \
- template class PCursor<a*>;
-#define IPL_instantiate(a) PL_instantiate(a); \
- template class IPointerList<a*>
#include "plist.icc"
diff --git a/flower/include/plist.tcc b/flower/include/plist.tcc
index ac9daedf71..d18e01f902 100644
--- a/flower/include/plist.tcc
+++ b/flower/include/plist.tcc
@@ -1,5 +1,10 @@
#include "plist.hh"
+#define PL_instantiate(a) template class PointerList<a*>; \
+ template class PCursor<a*>;
+#define IPL_instantiate(a) PL_instantiate(a); \
+ template class IPointerList<a*>
+
template<class T>
IPointerList<T>::~IPointerList()
{
diff --git a/flower/include/pointer.hh b/flower/include/pointer.hh
new file mode 100644
index 0000000000..e29a298ace
--- /dev/null
+++ b/flower/include/pointer.hh
@@ -0,0 +1,49 @@
+/*
+ pointer.hh -- declare P
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef POINTER_HH
+#define POINTER_HH
+
+/** P<T> is a handy template to use iso T*. It inits to 0, deletes on
+ destruction, deep copies upon copying
+
+ It is probably not feasible to use P<T> as template argument, since
+ a lot of auto conversion wouldn't work. new T would be called too
+ much anyway.
+
+ Sorry for the silly naming */
+template <class T>
+class P {
+
+ void copy(T*);
+ T* t_p;
+ void junk();
+public:
+
+ P(P const &src);
+
+ T *get_p() { T*p = t_p; t_p=0; return p; }
+ T *get_l() { return t_p; }
+ T *copy_p() const;
+ void set_p (T *new_p);
+ void set_l (T *t_l);
+
+ P &operator =(P const &);
+ ~P();
+ P() { t_p = 0; }
+ //P(T *p) { t_p = p; }
+
+ T *operator ->() { return t_p; }
+ operator T * () { return t_p; }
+ const T *operator ->() const { return t_p ; }
+ operator const T *() const { return t_p; }
+};
+#endif // POINTER_HH
+
+
diff --git a/flower/include/pointer.tcc b/flower/include/pointer.tcc
new file mode 100644
index 0000000000..d595f2bcfe
--- /dev/null
+++ b/flower/include/pointer.tcc
@@ -0,0 +1,88 @@
+/*
+ pointer.tcc -- implement P
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef POINTER_TCC
+#define POINTER_TCC
+
+template<class T>
+inline
+T *
+P<T>::copy_p()const
+{
+ return t_p? new T(*t_p) : 0;
+}
+
+template<class T>
+inline
+void
+P<T>::copy(T *l)
+{
+ t_p = l ? new T(*l) : 0;
+}
+
+template<class T>
+inline
+void
+P<T>::junk()
+{
+ delete t_p;
+ t_p =0;
+}
+
+template<class T>
+inline
+P<T>::P(P<T> const &s)
+{
+ t_p = s.copy_p();
+}
+
+template<class T>
+inline
+P<T> &
+P<T>::operator =(P const&s)
+{
+ junk();
+ copy(s.t_p);
+ return *this;
+}
+
+template<class T>
+inline
+P<T>::~P() {
+ junk();
+}
+
+template<class T>
+inline
+void
+P<T>::set_p(T * np)
+{
+ if (np == t_p)
+ return;
+ delete t_p;
+
+ t_p = np;
+}
+
+
+template<class T>
+inline
+void
+P<T>::set_l(T * l)
+{
+ if (t_p == l)
+ return;
+
+ junk();
+ copy(l);
+}
+
+
+
+#endif // POINTER_TCC
diff --git a/flower/lgetopt.cc b/flower/lgetopt.cc
index 37e8a00d8c..c2e5a3b790 100644
--- a/flower/lgetopt.cc
+++ b/flower/lgetopt.cc
@@ -155,7 +155,8 @@ Getopt_long::parseshort()
}
Long_option_init *
-Getopt_long::operator()() {
+Getopt_long::operator()()
+{
if (!next())
return 0;
diff --git a/flower/test/Makefile b/flower/test/Makefile
index 3de2bbdc70..1d909660e2 100644
--- a/flower/test/Makefile
+++ b/flower/test/Makefile
@@ -28,20 +28,6 @@ include ./$(depth)/make/Variables.make
include ./$(depth)/make/Files.make
#
-# descent order into subdirectories:
-#
-SUBDIRS =
-#
-
-# to be remade each build:
-#
-VERSION_DEPENDENCY = #
-#
-
-# module compile settings: (not generally needed!
-#
-
-
# list of distribution files:
#
EXTRA_DISTFILES = result
@@ -56,18 +42,15 @@ MODULE_LIBES = -lflower
# main target of this module:
#
-# MAINTARGET = $(EXECUTABLE)
-# MAINTARGET = $(LIBRARY)
MAINTARGET = $(lily_bindir)/$(EXECUTABLE)# huh?
-# MAINTARGET = $(libdir)/$(LIBRARY)# huh?
-
-#default: $(MAINTARGET)
BUILDSTRINGTEST=$(MAINTARGET)
EXECSTRINGTEST=$(EXECUTABLE)
-default: $(BUILDSTRINGTEST) do-stringtest
+# don't do the exec, as this might fail if flowerlib isn't installed yet.
+default: $(BUILDSTRINGTEST)
+
do-stringtest:
- $(EXECSTRINGTEST) > $(outdir)/result # should cmp with a 'standard result'
+ $(EXECSTRINGTEST) > $(outdir)/result
cmp $(outdir)/result result
dummy:
@@ -76,12 +59,7 @@ dummy:
#
include ./$(depth)/make/Targets.make
include ./$(depth)/make/Rules.make
-#
-# list of depend files:
-#
-DEPFILES = $(wildcard $(depdir)/*.dep )
-#
# auto dependencies:
#