Gnus development mailing list
 help / color / mirror / Atom feed
From: wmperry@aventail.com (William M. Perry)
Cc: ding@gnus.org
Subject: Re: I wanna write an RFC
Date: 17 Mar 1999 13:29:46 -0500	[thread overview]
Message-ID: <86hfrkj7fp.fsf@kramer.bp.aventail.com> (raw)
In-Reply-To: Per Abrahamsen's message of "17 Mar 1999 18:43:51 +0100"

[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]

Per Abrahamsen <abraham@dina.kvl.dk> writes:

> wmperry@aventail.com (William M. Perry) writes:
> 
> > Emacs/W3 is probably going to die very soon, due to lack of time and
> > interest on my part.
> 
> Arrgghh!  It has just gotten useful.  The way w3 displays text/html
> (after turning off all features) in Gnus means that it almost doesn't
> bother me anymore.  I also use it for following links in Gnus articles.

I agree that the integration with Gnus kicks ass, but there is no way that
I am going to bother implementing some of the stupid shit coming out of the 
W3C (CSS2 + CSS3).

I think a few things need to happen:

1) URL loading gets completely separated.  This is mostly done.  It could
   do with more of a rewrite to be even more asynch though.
2) XML parser as a c-level plugin or using the current external program +
   xml.el that I have attached.
3) A semi-minimal CSS2 implementation that would be enough to render simple 
   XML documents and tables correctly.
4) Perhaps use DSSSL in light of the stupid microsoft patent claiming to
   cover CSS.
5) More people than me and Thierry doing substantial work.

The current HTML parser and display engine could then suffer from bitrot
and not many people would care.

Between work, family, and trying to have more of a life, I just don't have
the time to devote to Emacs/W3 any more.  I'm going to talk to hrvoje,
steve, et al about some of this breakout and work while I am in japan.
I'll likely draft something that goes out to w3-beta and w3-dev as a plea
for help on the plan outlined above on the plane ride over.

If only I could convince Aventail to pay me to write elisp instead of
(shudder) C/C++.[1]

> Netscape is still used as the "stand-alone" browser, for reading
> /. and comics.

More sites tend more and more to be unusable without javascript and other
stupid shit.  Truly depressing.  I avoid the web like the plague it has
become. :)

-Bill P.

[1] I did at one point have a pretty kick-ass Emacs interface to our server
config file that we actually sent to some customers that wanted a TTY
version of the config tool. :)


[-- Attachment #2: sample expat-based xml->elisp parser --]
[-- Type: text/plain, Size: 4349 bytes --]

/*
The contents of this file are subject to the Mozilla Public License
Version 1.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.

The Original Code is expat.

The Initial Developer of the Original Code is James Clark.
Portions created by James Clark are Copyright (C) 1998
James Clark. All Rights Reserved.

Contributor(s):
*/

#include "xmlparse.h"

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <fcntl.h>

#ifdef _MSC_VER
#include <io.h>
#endif

#ifndef O_BINARY
#ifdef _O_BINARY
#define O_BINARY _O_BINARY
#else
#define O_BINARY 0
#endif
#endif

#ifdef _MSC_VER
#include <crtdbg.h>
#endif

#ifdef _DEBUG
#define READ_SIZE 16
#else
#define READ_SIZE (1024*8)
#endif

static void characterData(void *userData, const char *s, int len)
{
	FILE *fp = userData;
	putc('"',fp);
	for (; len > 0; --len, ++s) {
		putc(*s,fp);
	}
	putc('"',fp);
}

/* Lexicographically comparing UTF-8 encoded attribute values,
is equivalent to lexicographically comparing based on the character number. */

static int attcmp(const void *att1, const void *att2)
{
	return strcmp(*(const char **)att1, *(const char **)att2);
}

static void startElement(void *userData, const char *name, const char **atts)
{
	int nAtts;
	const char **p;
	FILE *fp = userData;
	putc('\n',fp);
	putc('(', fp);
	fputs(name, fp);
	putc('\n',fp);

	p = atts;
	while (*p)
		++p;
	nAtts = (p - atts) >> 1;
	if (nAtts > 1)
		qsort((void *)atts, nAtts, sizeof(char *) * 2, attcmp);

	putc('(',fp);
	putc('\n',fp);
	while (*atts) {
		putc('(', fp);
		fputs(*atts++, fp);		/* attribute */
		fputs(" . ",fp);
		characterData(userData, *atts, strlen(*atts));
		fputs(")\n",fp);
		atts++;
	}
	putc(')',fp);
}

static void endElement(void *userData, const char *name)
{
	FILE *fp = userData;
	fputs("\n); close tag ",fp);
	fputs(name, fp);
	putc('\n', fp);
}

static
void processingInstruction(void *userData, const char *target, const char *data)
{
  FILE *fp = userData;
  fprintf(fp, "<?%s %s?>", target, data);
}

static
void reportError(XML_Parser parser, const char *filename)
{
	int code = XML_GetErrorCode(parser);
	const char *message = XML_ErrorString(code);
	if (message)
		fprintf(stdout, "%s:%d:%ld: %s\n",
				filename,
				XML_GetErrorLineNumber(parser),
				XML_GetErrorColumnNumber(parser),
				message);
	else
		fprintf(stderr, "%s: (unknown message %d)\n", filename, code);
}

static
int processStream(const char *filename, XML_Parser parser)
{
	int fd;

	if (!strcmp(filename,"-"))
		fd = fileno(stdin);
	else
		fd = open(filename, O_BINARY|O_RDONLY);
	if (fd < 0) {
		perror(filename);
		return 0;
	}
	for (;;) {
		int nread;
		char *buf = XML_GetBuffer(parser, READ_SIZE);
		if (!buf) {
			close(fd);
			fprintf(stderr, "%s: out of memory\n", filename);
			return 0;
		}
		nread = read(fd, buf, READ_SIZE);
		if (nread < 0) {
			perror(filename);
			close(fd);
			return 0;
		}
		if (!XML_ParseBuffer(parser, nread, nread == 0)) {
			reportError(parser, filename);
			close(fd);
			return 0;
		}
		if (nread == 0) {
			close(fd);
			break;;
		}
	}
	return 1;
}

static
void usage(const char *prog)
{
	fprintf(stderr, "usage: %s [-e encoding] file ...\n", prog);
	exit(1);
}

int main(int argc, char **argv)
{
	int i;
	const char *encoding = NULL;

#ifdef _MSC_VER
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
#endif

	if (argc < 2)
		usage(argv[0]);
	
	for (i = 1; i < argc; i++) {
		if ((argv[i][0] == '-') && argv[i][1]) {
			switch (argv[i][1]) {
			case 'e':
				encoding = argv[++i];
				break;
			default:
				usage(argv[0]);
				break;
			}
		} else {
			FILE *fp = NULL;
			char *outName = 0;
			int result;
			XML_Parser parser = XML_ParserCreate(encoding);
			fp = stdout;

			XML_SetUserData(parser, fp);
			XML_SetElementHandler(parser, startElement, endElement);
			XML_SetCharacterDataHandler(parser, characterData);
			XML_SetProcessingInstructionHandler(parser, processingInstruction);

			result = processStream(argv[i], parser);

			XML_ParserFree(parser);
		}
	}
	return 0;
}

  parent reply	other threads:[~1999-03-17 18:29 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-14 16:44 Lars Magne Ingebrigtsen
1999-03-15 15:14 ` Jari Aalto+list.ding
1999-03-16  1:18 ` David Hedbor
1999-03-16  7:29   ` Hrvoje Niksic
1999-03-16 22:42     ` David Hedbor
1999-03-17 12:18       ` David Kågedal
1999-03-17 12:24         ` Hrvoje Niksic
1999-03-28 14:59         ` Lars Magne Ingebrigtsen
1999-03-17  1:25   ` Norman Walsh
1999-03-17 15:42     ` Laura Conrad
1999-03-17 16:06       ` Lee Willis
1999-03-17 16:29         ` Hrvoje Niksic
1999-03-17 16:35           ` Didier Verna
1999-03-17 17:15           ` William M. Perry
1999-03-17 17:43             ` Per Abrahamsen
1999-03-17 16:44               ` François Pinard
1999-03-17 18:01               ` Harry Putnam
1999-03-17 18:21                 ` William M. Perry
1999-03-18 17:27                   ` Harry Putnam
1999-03-17 18:30                 ` Per Abrahamsen
1999-03-17 18:29               ` William M. Perry [this message]
1999-03-18  0:10         ` Norman Walsh
1999-03-18  9:03           ` William M. Perry
1999-03-18 11:07             ` Robert Bihlmeyer
1999-03-18 12:56               ` Hrvoje Niksic
1999-03-18 13:16                 ` David Kågedal
1999-03-18 14:59                   ` Hrvoje Niksic
1999-03-18 15:19                     ` Didier Verna
1999-03-18 19:32                       ` Kim-Minh Kaplan
1999-03-19  9:18                         ` Didier Verna
1999-03-19 20:10                           ` Kim-Minh Kaplan
1999-03-18 19:32                     ` Zlatko Calusic
1999-03-19 14:03               ` Gerald Preissler
1999-03-28 15:02           ` Lars Magne Ingebrigtsen
1999-03-29  3:41             ` François Pinard
1999-04-02 13:56               ` Lars Magne Ingebrigtsen
1999-04-02 15:50                 ` François Pinard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86hfrkj7fp.fsf@kramer.bp.aventail.com \
    --to=wmperry@aventail.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).