DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T e

⟦700bc225f⟧ TextFile

    Length: 4575 (0x11df)
    Types: TextFile
    Names: »edit.dat«

Derivation

└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21E/musbus/Workload/edit.dat« 
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/musbus/Workload/edit.dat« 

TextFile

/*
 *  COBBLED program - test for editing
 *
 *  edit [ chars_per_sec ]
 *
 *  $Header: edit.dat,v 3.3 86/01/30 07:53:17 kenj Beta $
 */

#include <stdio.h>
#include "../../install/signal.h"

#define MEAN	5
#define GRANULE	5

int	thres;
int	est_mean = MEAN;

main(argc, argv)
int	argc;
char	*argv[];
{
	int	onalarm();

	if (argc == 2) {
		est_mean = atoi(argv[1]);
		if (est_mean <= 0) {
			fprintf(stderr, "edit: bad mean, reset to %d chars/sec\n", MEAN);
			est_mean = MEAN;
		}
	}

/**
 ** BEGIN BLOCK OF INSERTED TEXT TO BOOST FILE SIZE
This is some text which has been added to the middle of
the file to increase the file size to the point where it is realistic.

How 'bout some random pascal code?

program elcheapo(input, output);

const
    DISPSIZE = 10;	{ display is DISPSIZE characters long }
    SIGN = 1;		{ sign at display[SIGN] }
    NSTART = 2;		{ number starts is display[NSTART] }
    NEND = 9;		{ . and ends at display[NEND] }
    ERRFLAG = 10;	{ error flag display[ERFLAG] }

type
    st = (OK, ERROR);
    vt = (INTEGER, REAL);
    key = (DOT,PLUS,MINUS,DIV,MULT,EQUAL,ON,OFF,CLEAR,NEG,noop);
    number = record value: real;
		    scale: integer;
		    vtype: vt;
	     end;

var
    r, m: number;
    ukey: integer;
    code, lastop: key;
    done: boolean;
    state: st;
    disp: array [1..DISPSIZE] of char;

function power(base, n: integer): integer;
var i, value: integer;
begin
    value := 1;
    for i := 1 to n do value := value * base;
    power := value
end; { power }

procedure getkey(var code: integer);
var c: char;
begin
    read(c);
    if (c >= '0') and (c <= '9') then code := ord(c) - ord('0')
    else
    begin   if c = '.' then code := 10
	    else if c = '+' then code := 11
	    else if c = '-' then code := 12
	    else if c = '/' then code := 13
	    else if c = '*' then code := 14
	    else if c = '=' then code := 15
	    else if c = 'c' then code := 18
	    else if c = 'n' then code := 19
	    else if c = 'o' then
	    begin   read(c);
		    if c = 'n' then code := 16
		    else code := 17
	    end
	    else code := 20
    end;
    readln
end; { getkey }

function mapkey(code: integer): key;
begin
    if code = 10 then mapkey := DOT
    else if code = 11 then mapkey := PLUS
    else if code = 12 then mapkey := MINUS
    else if code = 13 then mapkey := DIV
    else if code = 14 then mapkey := MULT
    else if code = 15 then mapkey := EQUAL
    else if code = 16 then mapkey := ON
    else if code = 17 then mapkey := OFF
    else if code = 18 then mapkey := CLEAR
    else if code = 19 then mapkey := NEG
    else mapkey := noop
end; { mapkey }


begin
    done := false;
    state := ERROR;
    while not done do
    begin   getkey(ukey);
	    code := mapkey(ukey);
	    if (code = ON) or (code = CLEAR) then
	    begin clear(m);
		  clear(r);
		  state := OK;
		  lastop := noop;
		  display(r)
	    end
	    else if code = OFF then done := true
	    else if state = OK then
	    begin   if (ukey >= 0) and (ukey <= 9) then
		    begin   if r.vtype = INTEGER then r.value := r.value*10 + ukey
			    else
			    begin   r.scale := r.scale + 1;
				    r.value := r.value + ukey / power(10, r.scale)
			    end;
			    display(r);
			    if lastop = EQUAL then lastop := noop
		    end
		    else if (code = PLUS) or (code = MINUS) or (code = MULT) or
			    (code = DIV) then
		    begin if lastop = noop then m := r
			  else if lastop <> EQUAL then
			  begin eval(m, r, lastop);
				display(m)
			  end;
			  clear(r);
			  lastop := code
		    end
		    else case code of
		    DOT:
			begin if r.vtype = REAL then state := ERROR
			      else r.vtype := REAL;
			      display(r)
			end;
		    EQUAL:
			begin if (lastop <> noop) and (lastop <> EQUAL) then
			      begin eval(m, r, lastop);
			            display(m)
			      end;	
			      clear(r);
			      lastop := EQUAL
			end;
		    NEG:
			begin r.value := -r.value;
			      display(r)
			end;
		end { of case }
  	    end { of else }
    end { of while }
end.
 ** END BLOCK OF INSERTED TEXT TO BOOST FILE SIZE
 **/

	/* (busy) wait for lock file ... */
	while ((f = open("lock", 0)) < 0) sleep(3);
	close(f);
	signal(SIGALRM, onalarm);
	alarm(GRANULE);
	while (read(0, &c, 1) == 1) {
		if (i % 20 == 0 && thres - i > est_mean * GRANULE)
			sleep(rand() & 0x3);
		write(1, &c, 1);
		write(2, &c, 1);	/* copy onto std error */
		i++;
		if (i > thres) {
			pause();
		}
	}
}
Filler to make 200 lines & 4500 bytes.
This
is
so
boring
you
wouldn't
believe it.

onalarm()
{
    thres += est_rate;
    signal(SIGALRM, onalarm);
    alarm(GRANULE);
}