[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 8 10:35:58 2001 
Subject:Re: ? text-processing examples 
From: 
Volume-ID:1010608.02 

In article <9fq2ra$5ka$1@ctb-nnrp2.saix.net>,
	cglur@onwe.co.za writes:
> (Aaron Sloman) wrote: 
> Well, my initial polog experiments overly impressed me until I realised
> that elements of: [man in boat] ; are tokens (items for poplog), and NOT
> 'text-strings'. Unfortunately, human knowledge is embedded in text-strings.

<blinks> It is?

I'm not sure what you mean by that. *Some* human knowledge is encoded
in machine-readable text-strings. An aweful lot isn't.

> I want to be able to read text files from various sources/css/formats,
> with some guidance/assistance from string-search facilities.  
> And manually extract text-sections to various different holders/files; 
> ie. use human evaluation.  
> 
> Modifying the code below, I was not able to send the alternate (to file 
> 'testout') text strings to screen. 
>      char =>   ;;; produces <numeric value of char> 

`cucharout(aCharacter)` sends the character value [in] `aCharacter` to
the current output stream.

If `myOut` is a variable bound to an output stream (a "character consumer"
in Pop terminology) then, similarly, `myOut(aCharacter)` sends that character
to that output stream.

The default value of `cucharout` sends characters to the "standard output"
than Poplog started with. (It need not be "the screen", since Poplog will
work fine even if all you have is a teletype, or if the output has been
redirected, Unix-style, to a file, socket, serial line, or DAC).

In Ved, working in immediate mode, the default `cucharout` sends characters
to the current output window.

>> 	define transform_file(inputfile, outputfile);
>> 		lvars
>> 			produce = discin(inputfile),
>> 			consume = discout(outputfile),
>> 			char;
>> 
>> 		repeat
>> 			produce() -> char;
>> 			quitif (char == termin);
>> 			if char < 128 then consume(char)
>> 			else
>> 				;;; whatever you want to go out, e.g. nothing,
>> 				;;; or some translation
>> 			endif;
>> 		endrepeat;
>> 		consume(termin); 	;;; to flush output buffer
>> 	enddefine;
>> 
>> Then
>> 	transform_file('testin', 'testout');
>> 
>> will read the file called 'testin' and write the transformed
>> version to 'testout'. 
> All this automagically behind the scene eg. opening and closing files, is
> frightening to me .  
> Apparently that's what hi-level programming is about ?

That's what *programming* is about: hiding irrelevant details.

Whichy bit was frightening, and can you say why? It may help us to suggest
a good way for you to get into this. 

Are any Pop11 books still in print?

-- 
Chris "I don't like `cucharout`, as it happens" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html