head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	2013.05.31.05.56.37;	author agc;	state Exp;
branches;
next	;
commitid	nDg2ioUTUdn4iKRw;


desc
@@


1.1
log
@Re-do completely the way that external modules are loaded in eawk.
For now, use a

	use("digest")

style statement in the script to enable the bindings in a
libeawk-digest.so to be loaded via dlopen(3).

Also add readrec() and writerec() callbacks for use in embedded
programs, so that eawk can really be deeply embedded in other things,
and used as a command interpreter, etc.

Other headline changes include:
+ added gawk-style bit arithmetic ops
+ added gawk-style asort/asorti
+ added eawk_readrec() and eawk_writerec() callbacks for use
  in embedded operations
+ added extension use via use() command
+ added extensions for
	base64
	c
	circa
	db
	digests
	dirent
	getopt2
	hmac
	http
	mat
	netdiff
	netpgp
	progress
	rs
	soundex
	termcap

The upshot is that we can extend awk quite easily, as shown by this example
script:

% cat scripts/conn2.sh
#! /bin/sh

env LD_LIBRARY_PATH=lib:extend/c bin/eawk -v host=$1 '
BEGIN {
        use("c");
        if (host == "") print "phooey#0";
        addr["ai_family"] = PF_INET;
        if (getaddrinfo(host, "http", addr) != 0) print "phooey#1";
        sd = socket(PF_INET, SOCK_STREAM, 0);
        if (connect(sd, addr["ai_addr"], addr["ai_addrlen"]) != 0) print "phooey#2";
        s = sprintf("GET / HTTP/1.1\r\nHost: %s\r\nUser-Agent: eawk-2.1\r\n\r\n", host);
        write(sd, s, length(s));
        url = read(sd, 4096);
        print url;
        close(sd);
}'
% sh scripts/conn2.sh www.netbsd.org
HTTP/1.1 200 OK
Date: Fri, 31 May 2013 05:49:44 GMT
Server: Apache/2.2.24 (Unix)
Last-Modified: Sun, 19 May 2013 17:44:20 GMT
ETag: "83765-4fd9-4dd15c40bc500"
Accept-Ranges:  none
Content-Length: 20441
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <!-- Copyright (c) 1994-2011
         The NetBSD Foundation, Inc.  ALL RIGHTS RESERVED. -->
    <link rev="made" href="mailto:www@@NetBSD.org">
    <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="global.css" type="text/css">
    <link rel="alternate" type="application/rss+xml" title="NetBSD news"
          href="http://www.NetBSD.org/changes/rss-netbsd.xml">
    <title>The NetBSD Project</title>
    <meta name="DESCRIPTION" content="PowerPC, Alpha, SPARC, MIPS, SH3, ARM, amd64, i386, m68k, VAX: Of course it runs NetBSD.">
    <meta name="KEYWORDS" content="NetBSD, BSD, 4.4BSD, UNIX, acorn26, acorn32, algor, algorithmics, alpha, amiga, amigappc, arc, arm26, arm32, atari, bebox, cats, cesfic, cobalt, evbarm, evbmips, evbppc, evbsh3, ews4800, hp300, hp700, hpcarm, hpcmips, hpcsh, hppa, i386, ibmnws, iyonix, luna68k, m68k, mac68k, macppc, mips, mmeye, mvme68k, mvmeppc, netwinder, news68k, newsmips, next68k, mipsco, ofppc, pica, pmax, pmppc, p
%
@
text
@#	$NetBSD: Makefile,v 1.1.1.1 2011/08/31 04:19:41 agc Exp $

.include <bsd.own.mk>

DIST=	${.CURDIR}/../../dist
.PATH:	${DIST}

LIB=	eawk-circa
SRCS=	circa.c
CPPFLAGS+=	-I. -I${DIST}
MKMAN=	no
LDADD+=	-lcirca

WARNS=	5

.include <bsd.lib.mk>
@
