mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-23 00:43:28 +00:00
Unbreak and fix:
* Use BSDmakefile (and bsd.lib.mk) instead of configure/Makefile.in; * plug some (but not all!) ancient memory leaks; * make use of bsd.tcl.mk (now requires Tcl-8.4 or higher); * fix warnings and 64-bit issues; * bump PORTREVISION. To do: * plug the remaining memory leak (valgrind is priceless!); * fix up the author's tests to uniformly report failure or success and arrange for them to run post-build. Feature safe: yes
This commit is contained in:
parent
a2a8e38c9e
commit
e4010ab91b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=294612
@ -7,22 +7,20 @@
|
||||
|
||||
PORTNAME= tclmidi
|
||||
PORTVERSION= 3.1
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= audio
|
||||
MASTER_SITES= ftp://ftp.cs.ruu.nl/pub/MIDI/PROGRAMS/ \
|
||||
http://ringtail.its.monash.edu.au/pub/midi/PROGRAMS/
|
||||
# despite references on the homepage to ftp.xor.com, that server
|
||||
# doesn't work - edwin 20021227
|
||||
MASTER_SITES= http://ringtail.its.monash.edu.au/pub/midi/PROGRAMS/
|
||||
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
COMMENT= A language designed for creating and editing standard MIDI files
|
||||
|
||||
LIB_DEPENDS= tcl82.1:${PORTSDIR}/lang/tcl82
|
||||
|
||||
MAKE_ENV= TCL_GENERIC_DIR=${LOCALBASE}/include/tcl8.2
|
||||
GNU_CONFIGURE= yes
|
||||
CONFIGURE_ARGS= --with-tclsh=${LOCALBASE}/bin/tclsh8.2
|
||||
USE_TCL= 84+
|
||||
MAKE_ENV= TCL_INCLUDEDIR="${TCL_INCLUDEDIR}" TCL_LIBDIR="${TCL_LIBDIR}"
|
||||
MAKE_ENV+= TCLSH=${TCLSH} FILESDIR="${FILESDIR}" MAN="${MAN1} ${MANN}"
|
||||
PKGMESSAGE= ${WRKDIR}/pkg-message
|
||||
SUB_FILES= pkg-message
|
||||
MAKE_JOBS_SAFE= yes
|
||||
MAKEFILE= ${FILESDIR}/BSDmakefile
|
||||
|
||||
MAN1= mplay.1 mrec.1 tclmidi.1 minfo.1 midtotcl.1
|
||||
MANN= midiconf.n midievnt.n midifree.n midiget.n midigrep.n \
|
||||
@ -30,19 +28,19 @@ MANN= midiconf.n midievnt.n midifree.n midiget.n midigrep.n \
|
||||
midirec.n midirew.n midisplt.n midistop.n midiwait.n \
|
||||
midiwrit.n midivers.n midimove.n midicopy.n mididel.n \
|
||||
miditrck.n mididev.n miditime.n midifeat.n
|
||||
MANCOMPRESSED= maybe
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
post-build:
|
||||
cd ${WRKSRC} && echo pkg_mkIndex . tclmidi31.so | ${TCLSH}
|
||||
|
||||
.if ${ARCH} == "ia64" || ${ARCH} == "sparc64"
|
||||
IGNORE= ignored due to cast from pointer to integer of different size
|
||||
.elif ${OSVERSION} >= 900000
|
||||
BROKEN= does not build
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
@${CP} -f ${FILESDIR}/strstream.h ${WRKSRC}
|
||||
|
||||
post-install:
|
||||
pre-su-install:
|
||||
.for s in mplay mrec minfo midtotcl
|
||||
${SED} 's|/usr/local/bin/tclsh|${TCLSH}|' \
|
||||
< ${WRKSRC}/$s.dist > ${PREFIX}/bin/$s
|
||||
${CHMOD} 755 ${PREFIX}/bin/$s
|
||||
.endfor
|
||||
@${CAT} ${PKGMESSAGE}
|
||||
${MKDIR} ${PREFIX}/lib/tclmidi
|
||||
${INSTALL_DATA} ${WRKSRC}/pkgIndex.tcl ${PREFIX}/lib/tclmidi/
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
.include <bsd.port.mk>
|
||||
|
30
audio/tclmidi/files/BSDmakefile
Normal file
30
audio/tclmidi/files/BSDmakefile
Normal file
@ -0,0 +1,30 @@
|
||||
SRCS= MidiDev.cxx TclmDr75.cxx ChanPres.cxx Event.cxx MChanPrf.cxx \
|
||||
MCopy.cxx MCue.cxx MEOT.cxx MEvent.cxx MInstNam.cxx MKey.cxx \
|
||||
MLyric.cxx MMarker.cxx MPortNum.cxx MSMPTE.cxx MSeqNam.cxx \
|
||||
MSeqNum.cxx MSeqSpec.cxx MTempo.cxx MText.cxx MTime.cxx \
|
||||
NormEvnt.cxx NoteOff.cxx NoteOn.cxx KeyPres.cxx Param.cxx \
|
||||
PitchWhl.cxx Program.cxx SysEx.cxx MUnknown.cxx EvntUtil.cxx \
|
||||
Note.cxx GusPatch.cxx SMFUtils.cxx SMFHead.cxx SMFTrack.cxx \
|
||||
EvntTree.cxx Song.cxx
|
||||
|
||||
SRCS+= TclmIntp.cxx tclmCmd.cxx tclmEvnt.cxx tclmPlay.cxx \
|
||||
tclmPtch.cxx tclmUtil.cxx
|
||||
|
||||
|
||||
SRCS+= rb.c list.c
|
||||
SHLIB_NAME= tclmidi31.so
|
||||
MANDIR= ${PREFIX}/man/man
|
||||
LIBDIR= ${PREFIX}/lib/tclmidi
|
||||
LDADD= -lstdc++
|
||||
|
||||
SUBDIRS=events device patch smf song rb
|
||||
INCLUDES= -I${TCL_INCLUDEDIR} ${SUBDIRS:S/^/-I/}
|
||||
CFLAGS+= ${INCLUDES} -Werror
|
||||
CXXFLAGS+= -Wall -Wno-deprecated ${INCLUDES} -I${FILESDIR}
|
||||
CXXFLAGS+= -DHAVE_UNISTD_H -DHAVE_SYS_FILIO_H -DHAVE_SYS_TIME_H -Werror
|
||||
CXXFLAGS+= -DUSE_INTERP_RESULT
|
||||
|
||||
.PATH: ${SUBDIRS} man
|
||||
WARNS= 5
|
||||
|
||||
.include <bsd.lib.mk>
|
@ -1,24 +1,35 @@
|
||||
--- Makefile.in.orig Mon Nov 9 18:00:54 1998
|
||||
+++ Makefile.in Mon Nov 9 17:47:11 1998
|
||||
--- Makefile.in 1996-10-09 23:32:36.000000000 -0400
|
||||
+++ Makefile.in 2012-04-07 12:07:34.000000000 -0400
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
# The directory containing the Tcl library archive file appropriate
|
||||
# for this version of Tk:
|
||||
-TCL_BIN_DIR = @TCL_BIN_DIR@
|
||||
+TCL_BIN_DIR = ${LOCALBASE}/lib/tcl8.2
|
||||
+TCL_BIN_DIR = ${TCL_LIBDIR}
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# The information below is modified by the configure script when
|
||||
@@ -35,7 +35,7 @@
|
||||
@@ -35,8 +35,9 @@
|
||||
VPATH = @srcdir@
|
||||
|
||||
CFLAGS = @CFLAGS@ @DEFS@
|
||||
-CC_SWITCHES = @CFLAGS@ @DEFS@ ${SHLIB_CFLAGS} \
|
||||
+CC_SWITCHES = @CFLAGS@ @DEFS@ ${SHLIB_CFLAGS} -I${TCL_GENERIC_DIR} \
|
||||
-Idevice -Ievents -Irb -Ipatch -Ismf -Isong -I.
|
||||
+CXX_SWITCHES= ${CC_SWITCHES} ${CXXFLAGS}
|
||||
|
||||
TCLMFILES = tclmCmd.o tclmUtil.o tclmEvnt.o tclmPlay.o tclmPtch.o TclmIntp.o
|
||||
@@ -101,7 +101,7 @@
|
||||
TCLMFILES_SRC = tclmCmd.cxx tclmUtil.cxx tclmEvnt.cxx tclmPlay.cxx \
|
||||
@@ -61,7 +62,7 @@
|
||||
@echo 'pkg_mkIndex . $(PROJ_LIB_NAME)' | @TCLSH_PATH@
|
||||
|
||||
.cxx.o:
|
||||
- @CXX@ -c $(CC_SWITCHES) $<
|
||||
+ @CXX@ -c $(CXX_SWITCHES) $<
|
||||
|
||||
$(PROJ_LIB_NAME): events/objs smf/objs \
|
||||
song/objs device/objs patch/objs rb/objs $(TCLMFILES)
|
||||
@@ -101,7 +102,7 @@
|
||||
|
||||
install: $(PROJ_LIB_NAME) $(SCRIPTS)
|
||||
-mkdir -p $(prefix)$(libdir)/tclmidi
|
||||
@ -27,3 +38,78 @@
|
||||
echo 'pkg_mkIndex $(prefix)$(libdir)/tclmidi \
|
||||
$(PROJECT)*${SHLIB_SUFFIX}' | @TCLSH_PATH@
|
||||
cd man; $(MAKE) install
|
||||
@@ -128,7 +129,7 @@
|
||||
sed "/[#]# Dependancies/,$$$$d" < Makefile > Makefile.tmp
|
||||
echo >> Makefile.tmp
|
||||
echo "##" "Dependancies" >> Makefile.tmp
|
||||
- @CXX@ -M $(CC_SWITCHES) $(TCLMFILES_SRC) >> Makefile.tmp
|
||||
+ @CXX@ -M $(CXX_SWITCHES) $(TCLMFILES_SRC) >> Makefile.tmp
|
||||
cp Makefile.tmp Makefile
|
||||
rm Makefile.tmp
|
||||
|
||||
--- device/Makefile.in 1996-10-09 23:32:40.000000000 -0400
|
||||
+++ device/Makefile.in 2012-04-07 12:13:09.000000000 -0400
|
||||
@@ -18,4 +18,5 @@
|
||||
-I$(srcdir)/../events -I$(srcdir)/../rb -I$(srcdir)/../patch \
|
||||
-I$(srcdir)/../smf -I$(srcdir)/../song -I$(srcdir)/.. -I$(srcdir)
|
||||
+CXX_SWITCHES= ${CC_SWITCHES} ${CXXFLAGS}
|
||||
|
||||
DEVICEFILES = MidiDev.o TclmDr75.o
|
||||
@@ -25,5 +26,5 @@
|
||||
|
||||
.cxx.o:
|
||||
- @CXX@ -c $(CC_SWITCHES) $<
|
||||
+ @CXX@ -c $(CXX_SWITCHES) $<
|
||||
|
||||
objs: $(DEVICEFILES)
|
||||
@@ -34,5 +35,5 @@
|
||||
echo >> Makefile.tmp
|
||||
echo "##" "Dependancies" >> Makefile.tmp
|
||||
- @CXX@ -M $(CC_SWITCHES) $(DEVICEFILES_SRC) >> Makefile.tmp
|
||||
+ @CXX@ -M $(CXX_SWITCHES) $(DEVICEFILES_SRC) >> Makefile.tmp
|
||||
cp Makefile.tmp Makefile
|
||||
rm Makefile.tmp
|
||||
--- events/Makefile.in 1996-10-09 23:32:42.000000000 -0400
|
||||
+++ events/Makefile.in 2012-04-07 12:15:41.000000000 -0400
|
||||
@@ -17,4 +17,5 @@
|
||||
CC_SWITCHES = @CFLAGS@ @DEFS@ -I${TCL_GENERIC_DIR} ${SHLIB_CFLAGS} \
|
||||
-I$(srcdir)/../smf -I$(srcdir)/../song -I$(srcdir)/.. -I$(srcdir)
|
||||
+CXX_SWITCHES = ${CC_SWITCHES} ${CXXFLAGS}
|
||||
|
||||
EVENTFILES = ChanPres.o Event.o MChanPrf.o MCopy.o MCue.o \
|
||||
@@ -36,5 +37,5 @@
|
||||
|
||||
.cxx.o:
|
||||
- @CXX@ -c $(CC_SWITCHES) $<
|
||||
+ @CXX@ -c $(CXX_SWITCHES) $<
|
||||
|
||||
objs: $(EVENTFILES)
|
||||
@@ -45,5 +46,5 @@
|
||||
echo >> Makefile.tmp
|
||||
echo "##" "Dependancies" >> Makefile.tmp
|
||||
- @CXX@ -M $(CC_SWITCHES) $(EVENTFILES_SRC) >> Makefile.tmp
|
||||
+ @CXX@ -M $(CXX_SWITCHES) $(EVENTFILES_SRC) >> Makefile.tmp
|
||||
cp Makefile.tmp Makefile
|
||||
rm Makefile.tmp
|
||||
--- patch/Makefile.in 1996-10-09 23:32:43.000000000 -0400
|
||||
+++ patch/Makefile.in 2012-04-07 12:23:29.000000000 -0400
|
||||
@@ -17,4 +17,5 @@
|
||||
CC_SWITCHES = @CFLAGS@ @DEFS@ -I${TCL_GENERIC_DIR} ${SHLIB_CFLAGS} \
|
||||
-I. -I..
|
||||
+CXX_SWITCHES = ${CC_SWITCHES} ${CXXFLAGS}
|
||||
|
||||
PATCHFILES = GusPatch.o
|
||||
@@ -24,5 +25,5 @@
|
||||
|
||||
.cxx.o:
|
||||
- @CXX@ -c $(CC_SWITCHES) $<
|
||||
+ @CXX@ -c $(CXX_SWITCHES) $<
|
||||
|
||||
objs: $(PATCHFILES)
|
||||
@@ -33,5 +34,5 @@
|
||||
echo >> Makefile.tmp
|
||||
echo "##" "Dependancies" >> Makefile.tmp
|
||||
- @CXX@ -M $(CC_SWITCHES) $(PATCHFILES_SRC) >> Makefile.tmp
|
||||
+ @CXX@ -M $(CXX_SWITCHES) $(PATCHFILES_SRC) >> Makefile.tmp
|
||||
cp Makefile.tmp Makefile
|
||||
rm Makefile.tmp
|
||||
|
2139
audio/tclmidi/files/patch-modern
Normal file
2139
audio/tclmidi/files/patch-modern
Normal file
File diff suppressed because it is too large
Load Diff
456
audio/tclmidi/files/patch-rb
Normal file
456
audio/tclmidi/files/patch-rb
Normal file
@ -0,0 +1,456 @@
|
||||
--- rb/rb.h 1994-12-05 16:57:58.000000000 -0500
|
||||
+++ rb/rb.h 2012-04-07 13:21:08.000000000 -0400
|
||||
@@ -34,38 +34,38 @@
|
||||
} v;
|
||||
} *Rb_node;
|
||||
|
||||
-#ifndef __P
|
||||
-#if defined(__STDC__) || defined(__cplusplus)
|
||||
-#define __P(protos) protos
|
||||
-#else
|
||||
-#define __P(protos) ()
|
||||
-#endif
|
||||
-#endif
|
||||
-
|
||||
+#ifndef EXTERN
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
-EXTERN Rb_node make_rb __P(());
|
||||
-EXTERN Rb_node rb_insert_b __P((Rb_node node, char *key, char *value));
|
||||
-
|
||||
-EXTERN Rb_node rb_find_key __P((Rb_node tree, char *key));
|
||||
-EXTERN Rb_node rb_find_ikey __P((Rb_node tree, int ikey));
|
||||
-EXTERN Rb_node rb_find_ukey __P((Rb_node tree, unsigned long ukey));
|
||||
-EXTERN Rb_node rb_find_gkey __P((Rb_node tree, char *key, int (*fxn)()));
|
||||
-
|
||||
-EXTERN Rb_node rb_find_key_n __P((Rb_node tree, char *key, int *found));
|
||||
-EXTERN Rb_node rb_find_ikey_n __P((Rb_node tree, int ikey, int *found));
|
||||
-EXTERN Rb_node rb_find_ukey_n __P((Rb_node tree, unsigned long ukey,
|
||||
- int *found));
|
||||
-EXTERN Rb_node rb_find_gkey_n __P((Rb_node tree, char *key, int (*fxn)(),
|
||||
- int *found));
|
||||
-EXTERN void rb_delete_node __P((Rb_node node));
|
||||
-EXTERN void rb_free_tree __P((Rb_node node)); /* Deletes and frees an entire tree */
|
||||
-EXTERN char *rb_val __P((Rb_node node)); /* Returns node->v.val
|
||||
+typedef int (*Rb_cmp)(const char *key1, const char *key2);
|
||||
+EXTERN Rb_node make_rb(void);
|
||||
+EXTERN Rb_node rb_insert_b(Rb_node node, char *key, char *value);
|
||||
+
|
||||
+EXTERN Rb_node rb_find_key(Rb_node tree, const char *key);
|
||||
+EXTERN Rb_node rb_find_ikey(Rb_node tree, int ikey);
|
||||
+EXTERN Rb_node rb_find_ukey(Rb_node tree, unsigned long ukey);
|
||||
+EXTERN Rb_node rb_find_gkey(Rb_node tree, const char *key, Rb_cmp);
|
||||
+
|
||||
+EXTERN Rb_node rb_find_key_n(Rb_node tree, const char *key, int *found);
|
||||
+EXTERN Rb_node rb_find_ikey_n(Rb_node tree, int ikey, int *found);
|
||||
+EXTERN Rb_node rb_find_ukey_n(Rb_node tree, unsigned long ukey,
|
||||
+ int *found);
|
||||
+EXTERN Rb_node rb_find_gkey_n(Rb_node tree, const char *key, Rb_cmp,
|
||||
+ int *found);
|
||||
+EXTERN void rb_delete_node(Rb_node node);
|
||||
+EXTERN void rb_free_tree(Rb_node node); /* Deletes and frees an entire tree */
|
||||
+EXTERN char *rb_val(Rb_node node); /* Returns node->v.val
|
||||
(this is to shut lint up */
|
||||
+EXTERN void rb_print_tree(const struct rb_node * const t, int level);
|
||||
+EXTERN void rb_iprint_tree(const struct rb_node * const t, int level);
|
||||
+EXTERN void rb_uprint_tree(const struct rb_node * const t, int level);
|
||||
+EXTERN int rb_nblack(const struct rb_node *t);
|
||||
+EXTERN int rb_plength(const struct rb_node *t);
|
||||
|
||||
#define rb_insert_a(n, k, v) rb_insert_b(n->c.list.flink, k, v)
|
||||
#define rb_insert(t, k, v) rb_insert_b(rb_find_key(t, k), k, v)
|
||||
@@ -84,5 +84,5 @@
|
||||
#define rb_traverse(ptr, lst) \
|
||||
for(ptr = rb_first(lst); ptr != nil(lst); ptr = rb_next(ptr))
|
||||
|
||||
-EXTERN void recolor __P(());
|
||||
-EXTERN void single_rotate __P(());
|
||||
+EXTERN void recolor(Rb_node);
|
||||
+EXTERN void single_rotate(Rb_node, int);
|
||||
--- rb/rb.c 1994-12-05 16:57:57.000000000 -0500
|
||||
+++ rb/rb.c 2012-04-07 13:22:05.000000000 -0400
|
||||
@@ -37,10 +37,8 @@
|
||||
setnormal(new);\
|
||||
}
|
||||
|
||||
-void
|
||||
-mk_new_int(l, r, p, il)
|
||||
- Rb_node l, r, p;
|
||||
- int il;
|
||||
+static void
|
||||
+mk_new_int(Rb_node l, Rb_node r, Rb_node p, int il)
|
||||
{
|
||||
Rb_node new;
|
||||
|
||||
@@ -71,9 +69,8 @@
|
||||
}
|
||||
|
||||
|
||||
-Rb_node
|
||||
-lprev(n)
|
||||
- Rb_node n;
|
||||
+static Rb_node
|
||||
+lprev(Rb_node n)
|
||||
{
|
||||
if (ishead(n))
|
||||
return (n);
|
||||
@@ -85,9 +82,8 @@
|
||||
return (n->p.parent);
|
||||
}
|
||||
|
||||
-Rb_node
|
||||
-rprev(n)
|
||||
- Rb_node n;
|
||||
+static Rb_node
|
||||
+rprev(Rb_node n)
|
||||
{
|
||||
if (ishead(n))
|
||||
return (n);
|
||||
@@ -109,24 +105,20 @@
|
||||
head->c.list.flink = head;
|
||||
head->c.list.blink = head;
|
||||
head->p.root = head;
|
||||
- head->k.key = "";
|
||||
+ /* head->k.key = ""; */
|
||||
head->v.val = NULL;
|
||||
sethead(head);
|
||||
return (head);
|
||||
}
|
||||
|
||||
Rb_node
|
||||
-rb_find_key_n(n, key, fnd)
|
||||
- Rb_node n;
|
||||
- char *key;
|
||||
- int *fnd;
|
||||
+rb_find_key_n(Rb_node n, const char *key, int *fnd)
|
||||
{
|
||||
int cmp;
|
||||
|
||||
*fnd = 0;
|
||||
if (!ishead(n)) {
|
||||
- fprintf(stderr, "rb_find_key_n called on non-head 0x%x\n",
|
||||
- (int)n);
|
||||
+ fprintf(stderr, "%s called on non-head %p\n", __func__, n);
|
||||
exit(1);
|
||||
}
|
||||
if (n->p.root == n)
|
||||
@@ -156,9 +148,7 @@
|
||||
}
|
||||
|
||||
Rb_node
|
||||
-rb_find_key(n, key)
|
||||
- Rb_node n;
|
||||
- char *key;
|
||||
+rb_find_key(Rb_node n, const char *key)
|
||||
{
|
||||
int fnd;
|
||||
|
||||
@@ -173,8 +163,7 @@
|
||||
{
|
||||
*fnd = 0;
|
||||
if (!ishead(n)) {
|
||||
- fprintf(stderr, "rb_find_ikey_n called on non-head 0x%x\n",
|
||||
- (int)n);
|
||||
+ fprintf(stderr, "%s called on non-head %p\n", __func__, n);
|
||||
exit(1);
|
||||
}
|
||||
if (n->p.root == n)
|
||||
@@ -208,8 +197,7 @@
|
||||
|
||||
*fnd = 0;
|
||||
if (!ishead(n)) {
|
||||
- fprintf(stderr, "rb_find_ukey_n called on non-head 0x%x\n",
|
||||
- (int)n);
|
||||
+ fprintf(stderr, "%s called on non-head %p\n", __func__, n);
|
||||
exit(1);
|
||||
}
|
||||
if (n->p.root == n)
|
||||
@@ -255,18 +243,13 @@
|
||||
}
|
||||
|
||||
Rb_node
|
||||
-rb_find_gkey_n(n, key, fxn, fnd)
|
||||
- Rb_node n;
|
||||
- char *key;
|
||||
- int (*fxn)();
|
||||
- int *fnd;
|
||||
+rb_find_gkey_n(Rb_node n, const char *key, Rb_cmp fxn, int *fnd)
|
||||
{
|
||||
int cmp;
|
||||
|
||||
*fnd = 0;
|
||||
if (!ishead(n)) {
|
||||
- fprintf(stderr, "rb_find_key_n called on non-head 0x%x\n",
|
||||
- (int)n);
|
||||
+ fprintf(stderr, "%s called on non-head %p\n", __func__, n);
|
||||
exit(1);
|
||||
}
|
||||
if (n->p.root == n)
|
||||
@@ -296,20 +279,15 @@
|
||||
}
|
||||
|
||||
Rb_node
|
||||
-rb_find_gkey(n, key, fxn)
|
||||
- Rb_node n;
|
||||
- char *key;
|
||||
- int (*fxn)();
|
||||
+rb_find_gkey(Rb_node n, const char *key, Rb_cmp fxn)
|
||||
{
|
||||
int fnd;
|
||||
|
||||
return (rb_find_gkey_n(n, key, fxn, &fnd));
|
||||
}
|
||||
+
|
||||
Rb_node
|
||||
-rb_insert_b(n, key, val)
|
||||
- Rb_node n;
|
||||
- char *key;
|
||||
- char *val;
|
||||
+rb_insert_b(Rb_node n, char *key, char *val)
|
||||
{
|
||||
Rb_node newleft, newright, newnode, p;
|
||||
|
||||
@@ -346,8 +324,7 @@
|
||||
}
|
||||
|
||||
void
|
||||
-recolor(n)
|
||||
- Rb_node n;
|
||||
+recolor(Rb_node n)
|
||||
{
|
||||
Rb_node p, gp, s;
|
||||
int done = 0;
|
||||
@@ -392,9 +369,7 @@
|
||||
}
|
||||
|
||||
void
|
||||
-single_rotate(y, l)
|
||||
- Rb_node y;
|
||||
- int l;
|
||||
+single_rotate(Rb_node y, int l)
|
||||
{
|
||||
int rl, ir;
|
||||
Rb_node x, yp;
|
||||
@@ -440,20 +415,17 @@
|
||||
}
|
||||
|
||||
void
|
||||
-rb_delete_node(n)
|
||||
- Rb_node n;
|
||||
+rb_delete_node(Rb_node n)
|
||||
{
|
||||
Rb_node s, p, gp;
|
||||
char ir;
|
||||
|
||||
if (isint(n)) {
|
||||
- fprintf(stderr, "Cannot delete an internal node: 0x%x\n",
|
||||
- (int)n);
|
||||
+ fprintf(stderr, "Cannot delete an internal node: %p\n", n);
|
||||
exit(1);
|
||||
}
|
||||
if (ishead(n)) {
|
||||
- fprintf(stderr, "Cannot delete the head of an rb_tree: 0x%x\n",
|
||||
- (int)n);
|
||||
+ fprintf(stderr, "Cannot delete the head of an rb_tree: %p\n", n);
|
||||
exit(1);
|
||||
}
|
||||
delete_item((List)n); /* Delete it from the list */
|
||||
@@ -579,120 +551,112 @@
|
||||
}
|
||||
|
||||
void
|
||||
-rb_print_tree(t, level)
|
||||
- Rb_node t;
|
||||
- int level;
|
||||
+rb_print_tree(const struct rb_node * const t, int level)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ishead(t) && t->p.parent == t) {
|
||||
- printf("tree 0x%x is empty\n",
|
||||
- (int)t);
|
||||
+ printf("tree %p is empty\n", t);
|
||||
} else if (ishead(t)) {
|
||||
- printf("Head: 0x%x. Root = 0x%x\n", (int)t, (int)t->p.root);
|
||||
+ printf("Head: %p. Root = %p\n", t, t->p.root);
|
||||
rb_print_tree(t->p.root, 0);
|
||||
} else {
|
||||
if (isext(t)) {
|
||||
for (i = 0; i < level; i++)
|
||||
putchar(' ');
|
||||
- printf("Ext node 0x%x: %c,%c: p=0x%x, k=%s\n", (int)t,
|
||||
+ printf("Ext node %p: %c,%c: p=%p, k=%s\n", t,
|
||||
isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
- (int)t->p.parent, t->k.key);
|
||||
+ t->p.parent, t->k.key);
|
||||
} else {
|
||||
rb_print_tree(t->c.child.left, level + 2);
|
||||
rb_print_tree(t->c.child.right, level + 2);
|
||||
for (i = 0; i < level; i++)
|
||||
putchar(' ');
|
||||
- printf("Int node 0x%x: %c,%c: l=0x%x, r=0x%x, p=0x%x, lr=(%s,%s)\n",
|
||||
- (int)t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
- (int)t->c.child.left, (int)t->c.child.right,
|
||||
- (int)t->p.parent, t->k.lext->k.key,
|
||||
+ printf("Int node %p: %c,%c: l=%p, r=%p, p=%p, lr=(%s,%s)\n",
|
||||
+ t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
+ t->c.child.left, t->c.child.right,
|
||||
+ t->p.parent, t->k.lext->k.key,
|
||||
t->v.rext->k.key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
-rb_iprint_tree(t, level)
|
||||
- Rb_node t;
|
||||
- int level;
|
||||
+rb_iprint_tree(const struct rb_node * const t, int level)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ishead(t) && t->p.parent == t) {
|
||||
- printf("tree 0x%x is empty\n", (int)t);
|
||||
+ printf("tree %p is empty\n", t);
|
||||
} else if (ishead(t)) {
|
||||
- printf("Head: 0x%x. Root = 0x%x, < = 0x%x, > = 0x%x\n",
|
||||
- (int)t, (int)t->p.root, (int)t->c.list.blink,
|
||||
- (int)t->c.list.flink);
|
||||
+ printf("Head: %p. Root = %p, < = %p, > = %p\n",
|
||||
+ t, t->p.root, t->c.list.blink,
|
||||
+ t->c.list.flink);
|
||||
rb_iprint_tree(t->p.root, 0);
|
||||
} else {
|
||||
if (isext(t)) {
|
||||
for (i = 0; i < level; i++)
|
||||
putchar(' ');
|
||||
- printf("Ext node 0x%x: %c,%c: p=0x%x, <=0x%x, >=0x%x k=%d\n",
|
||||
- (int)t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
- (int)t->p.parent, (int)t->c.list.blink,
|
||||
- (int)t->c.list.flink, t->k.ikey);
|
||||
+ printf("Ext node %p: %c,%c: p=%p, <=%p, >=%p k=%d\n",
|
||||
+ t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
+ t->p.parent, t->c.list.blink,
|
||||
+ t->c.list.flink, t->k.ikey);
|
||||
} else {
|
||||
rb_iprint_tree(t->c.child.left, level + 2);
|
||||
rb_iprint_tree(t->c.child.right, level + 2);
|
||||
for (i = 0; i < level; i++)
|
||||
putchar(' ');
|
||||
- printf("Int node 0x%x: %c,%c: l=0x%x, r=0x%x, p=0x%x, lr=(%d,%d)\n",
|
||||
- (int)t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
- (int)t->c.child.left, (int)t->c.child.right,
|
||||
- (int)t->p.parent, t->k.lext->k.ikey,
|
||||
+ printf("Int node %p: %c,%c: l=%p, r=%p, p=%p, lr=(%d,%d)\n",
|
||||
+ t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
+ t->c.child.left, t->c.child.right,
|
||||
+ t->p.parent, t->k.lext->k.ikey,
|
||||
t->v.rext->k.ikey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
-rb_uprint_tree(t, level)
|
||||
- Rb_node t;
|
||||
- int level;
|
||||
+rb_uprint_tree(const struct rb_node * const t, int level)
|
||||
{
|
||||
int i;
|
||||
if (ishead(t) && t->p.parent == t) {
|
||||
- printf("tree 0x%x is empty\n", (int)t);
|
||||
+ printf("tree %p is empty\n", t);
|
||||
} else if (ishead(t)) {
|
||||
- printf("Head: 0x%x. Root = 0x%x, < = 0x%x, > = 0x%x\n",
|
||||
- (int)t, (int)t->p.root, (int)t->c.list.blink,
|
||||
- (int)t->c.list.flink);
|
||||
+ printf("Head: %p. Root = %p, < = %p, > = %p\n",
|
||||
+ t, t->p.root, t->c.list.blink,
|
||||
+ t->c.list.flink);
|
||||
rb_uprint_tree(t->p.root, 0);
|
||||
} else {
|
||||
if (isext(t)) {
|
||||
for (i = 0; i < level; i++)
|
||||
putchar(' ');
|
||||
- printf("Ext node 0x%x: %c,%c: p=0x%x, <=0x%x, >=0x%x k=%lu\n",
|
||||
- (int)t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
- (int)t->p.parent, (int)t->c.list.blink,
|
||||
- (int)t->c.list.flink, t->k.ukey);
|
||||
+ printf("Ext node %p: %c,%c: p=%p, <=%p, >=%p k=%lu\n",
|
||||
+ t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
+ t->p.parent, t->c.list.blink,
|
||||
+ t->c.list.flink, t->k.ukey);
|
||||
} else {
|
||||
rb_uprint_tree(t->c.child.left, level + 2);
|
||||
rb_uprint_tree(t->c.child.right, level + 2);
|
||||
for (i = 0; i < level; i++)
|
||||
putchar(' ');
|
||||
- printf("Int node 0x%x: %c,%c: l=0x%x, r=0x%x, p=0x%x, lr=(%lu,%lu)\n",
|
||||
- (int)t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
- (int)t->c.child.left, (int)t->c.child.right,
|
||||
- (int)t->p.parent, t->k.lext->k.ukey,
|
||||
+ printf("Int node %p: %c,%c: l=%p, r=%p, p=%p, lr=(%lu,%lu)\n",
|
||||
+ t, isred(t) ? 'R' : 'B', isleft(t) ? 'l' : 'r',
|
||||
+ t->c.child.left, t->c.child.right,
|
||||
+ t->p.parent, t->k.lext->k.ukey,
|
||||
t->v.rext->k.ukey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
-rb_nblack(n)
|
||||
- Rb_node(n);
|
||||
+rb_nblack(const struct rb_node *n)
|
||||
{
|
||||
int nb;
|
||||
|
||||
if (ishead(n) || isint(n)) {
|
||||
fprintf(stderr,
|
||||
- "ERROR: rb_nblack called on a non-external node 0x%x\n",
|
||||
- (int)n);
|
||||
+ "ERROR: %s called on a non-external node %p\n",
|
||||
+ __func__, n);
|
||||
exit(1);
|
||||
}
|
||||
nb = 0;
|
||||
@@ -705,15 +669,14 @@
|
||||
}
|
||||
|
||||
int
|
||||
-rb_plength(n)
|
||||
- Rb_node(n);
|
||||
+rb_plength(const struct rb_node *n)
|
||||
{
|
||||
int pl;
|
||||
|
||||
if (ishead(n) || isint(n)) {
|
||||
fprintf(stderr,
|
||||
- "ERROR: rb_plength called on a non-external node 0x%x\n",
|
||||
- (int)n);
|
||||
+ "ERROR: %s called on a non-external node %p\n",
|
||||
+ __func__, n);
|
||||
exit(1);
|
||||
}
|
||||
pl = 0;
|
||||
@@ -725,13 +688,11 @@
|
||||
}
|
||||
|
||||
void
|
||||
-rb_free_tree(n)
|
||||
- Rb_node(n);
|
||||
+rb_free_tree(Rb_node n)
|
||||
{
|
||||
|
||||
if (!ishead(n)) {
|
||||
- fprintf(stderr,
|
||||
- "ERROR: Rb_free_tree called on a non-head node\n");
|
||||
+ fprintf(stderr, "%s called on non-head %p\n", __func__, n);
|
||||
exit(1);
|
||||
}
|
||||
while (rb_first(n) != nil(n)) {
|
@ -1,12 +1,30 @@
|
||||
--- smf/Makefile.in.orig Thu Oct 10 05:32:53 1996
|
||||
+++ smf/Makefile.in Mon Mar 15 16:30:42 2004
|
||||
@@ -14,7 +14,8 @@
|
||||
--- smf/Makefile.in Thu Oct 10 05:32:53 1996
|
||||
+++ smf/Makefile.in 2012-04-07 12:16:41.000000000 -0400
|
||||
@@ -14,7 +14,9 @@
|
||||
VPATH = @srcdir@
|
||||
|
||||
CFLAGS = @CFLAGS@ @DEFS@
|
||||
-CC_SWITCHES = @CFLAGS@ @DEFS@ -I${TCL_GENERIC_DIR} ${SHLIB_CFLAGS}
|
||||
+CC_SWITCHES = @CFLAGS@ @DEFS@ -I${TCL_GENERIC_DIR} ${SHLIB_CFLAGS} \
|
||||
+ -I$(srcdir)/../smf -I$(srcdir)/../song -I$(srcdir)/.. -I$(srcdir)
|
||||
+CXX_SWITCHES= ${CC_SWITCHES} ${CXXFLAGS}
|
||||
|
||||
SMFFILES = SMFUtils.o SMFHead.o SMFTrack.o
|
||||
SMFFILES_SRC = SMFUtils.cxx SMFHead.cxx SMFTrack.cxx
|
||||
@@ -22,7 +24,7 @@
|
||||
.SUFFIXES: .cxx $(SUFFIXES)
|
||||
|
||||
.cxx.o:
|
||||
- @CXX@ -c $(CC_SWITCHES) $<
|
||||
+ @CXX@ -c $(CXX_SWITCHES) $<
|
||||
|
||||
objs: $(SMFFILES)
|
||||
for f in $(SMFFILES) ; do echo smf/$$f ; done > objs
|
||||
@@ -31,6 +33,6 @@
|
||||
sed "/[#]# Dependancies/,$$$$d" < Makefile > Makefile.tmp
|
||||
echo >> Makefile.tmp
|
||||
echo "##" "Dependancies" >> Makefile.tmp
|
||||
- @CXX@ -M $(CC_SWITCHES) $(SMFFILES_SRC) >> Makefile.tmp
|
||||
+ @CXX@ -M $(CXX_SWITCHES) $(SMFFILES_SRC) >> Makefile.tmp
|
||||
cp Makefile.tmp Makefile
|
||||
rm Makefile.tmp
|
||||
|
@ -1,11 +1,30 @@
|
||||
--- song/Makefile.in.orig Thu Oct 10 05:32:55 1996
|
||||
+++ song/Makefile.in Mon Mar 15 16:39:34 2004
|
||||
@@ -15,7 +15,7 @@
|
||||
--- song/Makefile.in Thu Oct 10 05:32:55 1996
|
||||
+++ song/Makefile.in 2012-04-07 12:25:09.000000000 -0400
|
||||
@@ -15,7 +15,8 @@
|
||||
|
||||
CFLAGS = @CFLAGS@ @DEFS@
|
||||
CC_SWITCHES = @CFLAGS@ @DEFS@ -I${TCL_GENERIC_DIR} ${SHLIB_CFLAGS} \
|
||||
- -I$(srcdir)/../events -I$(srcdir)/../rb -I$(srcdir)/../smf -I$(srcdir)
|
||||
+ -I$(srcdir)/../events -I$(srcdir)/../rb -I$(srcdir)/../smf -I$(srcdir)/.. -I$(srcdir)
|
||||
+CXX_SWITCHES = ${CC_SWITCHES} ${CXXFLAGS}
|
||||
|
||||
SONGFILES = EvntTree.o Song.o
|
||||
SONGFILES_SRC = EvntTree.cxx Song.cxx
|
||||
@@ -23,7 +24,7 @@
|
||||
.SUFFIXES: .cxx $(SUFFIXES)
|
||||
|
||||
.cxx.o:
|
||||
- @CXX@ -c $(CC_SWITCHES) $<
|
||||
+ @CXX@ -c $(CXX_SWITCHES) $<
|
||||
|
||||
objs: $(SONGFILES)
|
||||
for f in $(SONGFILES) ; do echo song/$$f ; done > objs
|
||||
@@ -32,7 +33,7 @@
|
||||
sed "/[#]# Dependancies/,$$$$d" < Makefile > Makefile.tmp
|
||||
echo >> Makefile.tmp
|
||||
echo "##" "Dependancies" >> Makefile.tmp
|
||||
- @CXX@ -M $(CC_SWITCHES) $(SONGFILES_SRC) >> Makefile.tmp
|
||||
+ @CXX@ -M $(CXX_SWITCHES) $(SONGFILES_SRC) >> Makefile.tmp
|
||||
cp Makefile.tmp Makefile
|
||||
rm Makefile.tmp
|
||||
|
||||
|
@ -36,6 +36,7 @@ using std::strstreambuf;
|
||||
using std::istrstream;
|
||||
using std::ostrstream;
|
||||
using std::strstream;
|
||||
using namespace std;
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user