New Port: devel/cbind

This tool is designed to aid in the creation of Ada bindings to C.

PR:	ports/105182
Submitted By:	"John Merryweather Cooper" <john_m_cooper@yahoo.com>
Approved By:	flz (mentor)
This commit is contained in:
Frank J. Laszlo 2006-11-09 13:56:24 +00:00
parent d2424e5b1c
commit 136702793d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=176935
16 changed files with 389 additions and 0 deletions

View File

@ -114,6 +114,7 @@
SUBDIR += c_parser
SUBDIR += calibrator
SUBDIR += callgrind
SUBDIR += cbind
SUBDIR += cbrowser
SUBDIR += cc65
SUBDIR += ccache

41
devel/cbind/Makefile Normal file
View File

@ -0,0 +1,41 @@
# New ports collection makefile for: cbind
# Date created: 23 December 2002
# Whom: David Holm <david@realityrift.com>
#
# $FreeBSD$
#
PORTNAME= cbind
PORTVERSION= 6
CATEGORIES= devel
MASTER_SITES= ftp://ftp.cs.kuleuven.ac.be/pub/Ada-Belgium/cdrom/ase02_02/tools/cbind/ \
ftp://ftp.cnam.fr/pub2/Ada/PAL/swtools/cbind/
DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= david@realityrift.com
COMMENT= Translator for "thin" Ada bindings to C
USE_ZIP= yes
MAN1= cbind.1
${WRKSRC}= ${WRKDIR}/${PORTNAME}
.if !defined(NOPORTDOCS)
PLIST_SUB+= PORTDOCS=""
.else
PLIST_SUB+= PORTDOCS="@comment "
.endif
do-install:
@${INSTALL_PROGRAM} ${WRKSRC}/cbind ${PREFIX}/bin
@${INSTALL_PROGRAM} ${WRKSRC}/cbfe ${PREFIX}/bin
@${INSTALL_PROGRAM} ${WRKSRC}/cbpp ${PREFIX}/bin
@${INSTALL_DATA} ${WRKSRC}/cbind.1 ${PREFIX}/man/man1
.if !defined(NOPORTDOCS)
@${MKDIR} ${DESTDIR}${DOCSDIR}
@${INSTALL_DATA} ${WRKSRC}/DOCS ${DESTDIR}${DOCSDIR}
@${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${DOCSDIR}
.endif
.include <bsd.port.mk>

3
devel/cbind/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (cbind6.zip) = 250a2db4799376d3586070c175d6c279
SHA256 (cbind6.zip) = 206566d6981a100b7a9b0b7006eb87e6f11f5665a2ff97c6a917250b42d0b3ff
SIZE (cbind6.zip) = 101939

View File

@ -0,0 +1,22 @@
--- Makefile.orig Fri Sep 22 12:21:32 1995
+++ Makefile Sun Nov 5 13:48:50 2006
@@ -1,8 +1,8 @@
VERSION = 6
-CFLAGS= -g -DPUBLIC
+CFLAGS+= -DPUBLIC
LIBS =
-LINKER = cc
+LINKER = $(CC)
MAKEFILE= Makefile
@@ -139,7 +139,7 @@
touch:; touch $(GENED_SRC)
hostinfo.h: htype hostinfo
- hostinfo $@
+ ./hostinfo $@
c_perf.c: c.prf
gperf -N c_rsvd -t -p c.prf > $@

View File

@ -0,0 +1,11 @@
--- allocate.c.orig Fri May 19 16:53:10 1995
+++ allocate.c Mon Dec 23 08:38:17 2002
@@ -4,7 +4,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
#include "ansi.h"
#include "config.h"
#include "allocate.h"

View File

@ -0,0 +1,11 @@
--- buffer.c.orig Fri May 19 16:53:44 1995
+++ buffer.c Mon Dec 23 08:38:17 2002
@@ -5,7 +5,7 @@
*/
#include <sys/types.h>
-#include <malloc.h>
+#include <stdlib.h>
#include "ansi.h"
#include "buffer.h"
#include "allocate.h"

View File

@ -0,0 +1,11 @@
--- cbind.c.orig Fri May 19 17:17:06 1995
+++ cbind.c Mon Dec 23 08:38:17 2002
@@ -6,7 +6,7 @@
#include <sys/types.h>
#include <string.h>
#include <unistd.h>
-#include <malloc.h>
+#include <stdlib.h>
#undef NULL
#define NULL 0

View File

@ -0,0 +1,10 @@
--- cdep.c.orig Fri May 19 19:19:36 1995
+++ cdep.c Mon Dec 23 08:38:17 2002
@@ -12,6 +12,7 @@
#include "cpp.h"
#include "cpp_hide.h"
#include "allocate.h"
+#include "host.h"
#undef NULL
#define NULL 0

View File

@ -0,0 +1,115 @@
--- errors.c.orig Fri Oct 28 19:44:44 1994
+++ errors.c Sat Nov 4 22:03:45 2006
@@ -1,5 +1,5 @@
#include <stdio.h>
-#include <varargs.h>
+#include <stdarg.h>
#include <errno.h>
int Num_Errors;
@@ -33,75 +33,63 @@
}
void
-fatal(f, l, fmt, va_alist)
- char *f, *fmt;
- int l;
- va_dcl
+fatal(char *f, int l, char *fmt, ...)
{
- va_list args;
+ va_list ap;
- va_start(args);
+ va_start(ap, fmt);
prefix(f,l,"Internal error");
- vfprintf(stderr, fmt, args);
+ vfprintf(stderr, fmt, ap);
endmsg();
- va_end(args);
+ va_end(ap);
exit(1);
}
void
-error(f, l, fmt, va_alist)
- char *f, *fmt;
- int l;
- va_dcl
+error(char *f, int l, char *fmt, ...)
{
- va_list args;
+ va_list ap;
- va_start(args);
+ va_start(ap, fmt);
Num_Errors++;
prefix(f,l,"Error");
- vfprintf(stderr, fmt, args);
+ vfprintf(stderr, fmt, ap);
endmsg();
- va_end(args);
+ va_end(ap);
}
void
-warning(f, l, fmt, va_alist)
- char *f, *fmt;
- int l;
- va_dcl
+warning(char *f, int l, char *fmt, ...)
{
- va_list args;
+ va_list ap;
- va_start(args);
+ va_start(ap, fmt);
Num_Warnings++;
prefix(f,l,"Warning");
- vfprintf(stderr, fmt, args);
+ vfprintf(stderr, fmt, ap);
endmsg();
- va_end(args);
+ va_end(ap);
}
void
-inform(f, l, fmt, va_alist)
- char *f, *fmt;
- int l;
- va_dcl
+inform(char *f, int l, char *fmt, ...)
{
- va_list args;
+ va_list ap;
- va_start(args);
+ va_start(ap, fmt);
prefix(f,l,"Info");
- vfprintf(stderr, fmt, args);
+ vfprintf(stderr, fmt, ap);
endmsg();
- va_end(args);
+ va_end(ap);
}
void
@@ -118,9 +106,6 @@
static void
unix_error()
{
- extern char *sys_errlist[];
- extern int sys_nerr;
-
if (errno != 0) {
if (errno > 0 && errno < sys_nerr) {
fputs(sys_errlist[errno], stderr);

View File

@ -0,0 +1,18 @@
--- files.c.orig Fri May 19 16:45:30 1995
+++ files.c Mon Dec 23 08:38:17 2002
@@ -1,5 +1,6 @@
#include "ansi.h"
#include "hostinfo.h"
+#include "host.h"
#include "config.h"
#include <sys/types.h>
@@ -11,7 +12,7 @@
#include <sys/mman.h>
#else
#include <unistd.h>
-#include <malloc.h>
+#include <stdlib.h>
#endif
#undef NULL

View File

@ -0,0 +1,11 @@
--- hostinfo.orig Thu Apr 7 15:03:16 1994
+++ hostinfo Mon Dec 23 08:38:17 2002
@@ -4,7 +4,7 @@
echo '/* This file is automatically generated */' > $1
echo '#define _H_HOSTINFO_' >> $1
-htype >> $1
+./htype >> $1
cat > llchk.c << _STOP
main()

View File

@ -0,0 +1,17 @@
--- htype.c.orig Fri May 19 16:52:08 1995
+++ htype.c Mon Dec 23 08:38:17 2002
@@ -132,10 +132,14 @@
printf("\n#define CHARS_ARE_%sSIGNED\n", (((char)-1) < 0) ? "" : "UN");
if (*p == 1) {
+ puts("#ifndef BIG_ENDIAN");
puts("#define BIG_ENDIAN");
+ puts("#endif");
}
else {
+ puts("#ifndef LITTLE_ENDIAN");
puts("#define LITTLE_ENDIAN");
+ puts("#endif");
}
return 0;

View File

@ -0,0 +1,87 @@
--- nodeop.c.orig Fri May 19 16:50:54 1995
+++ nodeop.c Sun Nov 5 13:39:44 2006
@@ -1,5 +1,5 @@
#include <sys/types.h>
-#include <varargs.h>
+#include <stdarg.h>
#include <stdio.h>
#include "ansi.h"
#include "host.h"
@@ -85,52 +85,50 @@
}
node_t*
-new_node(kind, va_alist)
- node_kind_t kind;
- va_dcl
+new_node(node_kind_t kind, ...)
{
- va_list args;
+ va_list ap;
node_t *n;
- va_start(args);
+ va_start(ap, kind);
n = alloc_node(kind);
switch (node_classof(kind)) {
case _Binary:
- n->node.binary.l = va_arg(args, node_t*);
- n->node.binary.r = va_arg(args, node_t*);
+ n->node.binary.l = va_arg(ap, node_t*);
+ n->node.binary.r = va_arg(ap, node_t*);
break;
case _Unary:
- n->node.unary = va_arg(args, node_t*);
+ n->node.unary = va_arg(ap, node_t*);
break;
case _Pointer:
- n->node.id.name = va_arg(args, char*);
+ n->node.id.name = va_arg(ap, char*);
break;
case _Other:
switch (kind) {
case _Elipsis:
break;
case _String:
- n->node.str.form = va_arg(args, char*);
- n->node.str.len = va_arg(args, int);
+ n->node.str.form = va_arg(ap, char*);
+ n->node.str.len = va_arg(ap, int);
break;
case _Sym:
- n->node.sym = va_arg(args, symbol_t*);
+ n->node.sym = va_arg(ap, symbol_t*);
break;
case _Type:
- n->node.typ = va_arg(args, typeinfo_t*);
+ n->node.typ = va_arg(ap, typeinfo_t*);
break;
case _Cond:
- n->node.cond.bool = va_arg(args, node_t*);
- n->node.cond.tru = va_arg(args, node_t*);
- n->node.cond.fals = va_arg(args, node_t*);
+ n->node.cond.bool = va_arg(ap, node_t*);
+ n->node.cond.tru = va_arg(ap, node_t*);
+ n->node.cond.fals = va_arg(ap, node_t*);
break;
case _FP_Number:
- n->node.fval = va_arg(args, host_float_t);
+ n->node.fval = va_arg(ap, host_float_t);
break;
case _Int_Number:
- n->node.ival = va_arg(args, host_int_t);
+ n->node.ival = va_arg(ap, host_int_t);
break;
default:
fatal(__FILE__,__LINE__,"Unandled noded - (%d)", kind);
@@ -142,7 +140,7 @@
break;
}
- va_end(args);
+ va_end(ap);
return n;
}

View File

@ -0,0 +1,10 @@
--- units.c.orig Fri Sep 22 12:06:46 1995
+++ units.c Mon Dec 23 08:38:17 2002
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
+#include "host.h"
#include "ansi.h"
#include "files.h"
#include "units.h"

15
devel/cbind/pkg-descr Normal file
View File

@ -0,0 +1,15 @@
This tool is designed to AID in the creation of Ada bindings to C.
The code is provided "as is" without any warranty whatsoever. The
code is NOT copyrighted but is instead published to the public domain
as free software. Any attempt to copyright the tool will be refutable
in a court of law.
I am NOT intending to imply that the bindings generated by this
translator will be complete. This tool MAY/MAY NOT be useful as an
AID to generating bindings. Hopefully it can do a lot of the grunt
work for you.
WWW: ftp://ftp.cs.kuleuven.ac.be/pub/Ada-Belgium/cdrom/ase02_02/tools/cbind/
- David Holm
david@realityrift.com

6
devel/cbind/pkg-plist Normal file
View File

@ -0,0 +1,6 @@
bin/cbfe
bin/cbind
bin/cbpp
%%PORTDOCS%%%%DOCSDIR%%/DOCS
%%PORTDOCS%%%%DOCSDIR%%/README
%%PORTDOCS%%@dirrm %%DOCSDIR%%