Commit c673839b by kollo

version 1.13-3

parent 19199404
clr count,beat
@get_meminfo
hn$=env$("HOSTNAME")
split hn$,".",0,hn$,dummy$
tineserver hn$+"-cpu-info",asc("C")
tineexport MEM_TOTAL,SWAP_TOTAL,MEM_FREE
do
myprop=timer
omemfree=mem_free
@get_meminfo
if mem_free<>omemfree
tinebroadcast MEM_FREE
endif
tinecycle
loop
procedure get_meminfo
open "I",#1,"/proc/meminfo"
while not eof(#1)
lineinput #1,t$
t$=xtrim$(t$)
split t$,":",0,a$,b$
if a$="MEMTOTAL"
split b$,":",0,a$,b$
mem_total=val(a$)
else if a$="SWAPTOTAL"
split b$,":",0,a$,b$
swap_total=val(a$)
else if a$="MEMFREE"
split b$,":",0,a$,b$
MEM_FREE=val(a$)
else
' print a$
endif
wend
close #1
return
29.08.06 19:16:04.699 CDT[*unknown*] TINE HOME : [/home/hoffmann/DESY/tine/database/]
29.08.06 19:16:04.701 CDT[*unknown*] Reserved 100 client connection link entries
29.08.06 19:16:04.702 CDT[*unknown*] Reserved 100 client connection addr entries
29.08.06 19:16:04.703 CDT[*unknown*] Control Structures Swap information registered
29.08.06 19:16:04.707 CDT[*unknown*] UDP PORT 0: bound to 8054 (socket 3 blocking)
29.08.06 19:16:04.708 CDT[*unknown*] joining globals multicast group : success
29.08.06 19:16:04.710 CDT[*unknown*] UDP PORT 8004: bound to 8004 (socket 4 blocking)
29.08.06 19:16:04.710 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:16:04.711 CDT[*unknown*] UDP PORT 0: bound to 8055 (socket 5 blocking)
29.08.06 19:16:04.712 CDT[*unknown*] ENS: SENDER [FEC SENDER, EQP SENDER] added
29.08.06 19:16:04.717 CDT[*unknown*] joining multicast group : success
29.08.06 19:16:04.717 CDT[*unknown*] UDP PORT 9503: bound to 9503 (socket 6 blocking)
29.08.06 19:16:04.717 CDT[*unknown*] Attach SENDER MYPROP (100 msec): REFRESH
29.08.06 19:16:04.726 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:16:04.728 CDT[*unknown*] Attach SENDER COUNT% (100 msec): REFRESH
29.08.06 19:16:04.729 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:16:04.731 CDT[*unknown*] Attach SENDER BEAT (100 msec): REFRESH
29.08.06 19:16:04.731 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:16:04.734 CDT[*unknown*] Attach SENDER STATUS$ (100 msec): REFRESH
29.08.06 19:21:52.463 CDT[*unknown*] TINE HOME : [/home/hoffmann/DESY/tine/database/]
29.08.06 19:21:52.467 CDT[*unknown*] Reserved 100 client connection link entries
29.08.06 19:21:52.468 CDT[*unknown*] Reserved 100 client connection addr entries
29.08.06 19:21:52.479 CDT[*unknown*] Control Structures Swap information registered
29.08.06 19:21:52.481 CDT[*unknown*] UDP PORT 0: bound to 8054 (socket 3 blocking)
29.08.06 19:21:52.482 CDT[*unknown*] joining globals multicast group : success
29.08.06 19:21:52.484 CDT[*unknown*] UDP PORT 8004: bound to 8004 (socket 4 blocking)
29.08.06 19:21:52.486 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:21:52.491 CDT[*unknown*] UDP PORT 0: bound to 8055 (socket 5 blocking)
29.08.06 19:21:52.492 CDT[*unknown*] ENS: SENDER [FEC SENDER, EQP SENDER] added
29.08.06 19:21:52.505 CDT[*unknown*] joining multicast group : success
29.08.06 19:21:52.508 CDT[*unknown*] UDP PORT 9503: bound to 9503 (socket 6 blocking)
29.08.06 19:21:52.508 CDT[*unknown*] Attach SENDER MYPROP (100 msec): REFRESH
29.08.06 19:21:52.517 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:21:52.530 CDT[*unknown*] Attach SENDER COUNT% (100 msec): REFRESH
29.08.06 19:21:52.537 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:21:52.552 CDT[*unknown*] Attach SENDER BEAT (100 msec): REFRESH
29.08.06 19:21:52.558 CDT[*unknown*] Attach SENDER PROPS (500 msec): SINGLE
29.08.06 19:21:52.572 CDT[*unknown*] Attach SENDER STATUS$ (100 msec): REFRESH
HPMAGEN=0
MYPROP=0
MYPROP2=0
clr count%
status$=space$(100)+"Hallo ja ja j aj aj aj ajajaajajajajaj"
clr propcount,propcount1,propcount2
tinelisten HPMAGEN,enc
tinelisten MYPROP,prop
tinelisten MYPROP1,prop1
tinelisten MYPROP2,prop2
tinelisten COUNT%,np
tinelisten BEAT,bbb
tinelisten STATUS$,status
cls
do
tinecycle
loop
procedure np
print at(10,10);chr$(27);"[2K";count%
return
procedure bbb
print at(12,10);chr$(27);"[2K";100-propcount,100-propcount1,100-propcount2
clr propcount,propcount1,propcount2
return
procedure status
print at(13,10);chr$(27);"[2K Status:";status$
return
procedure ttt
print "Hallo",timer
return
procedure enc
print "Energie: ",timer,hpmagen
return
procedure prop1
print at(1,1);chr$(27);"[2KProp1: ";propcount1;" ";timer;" ";myprop1,"Rate: ",int(10*propcount1/(timer-proptim1))/10;" Hz"
if (propcount1 mod 100)=0
proptim1=timer
clr propcount1
endif
inc propcount1
return
procedure prop2
print at(2,1);chr$(27);"[2KProp2: ";propcount2;" ";timer;" ";myprop2,"Rate: ",int(10*propcount2/(timer-proptim2))/10;" Hz"
if (propcount2 mod 100)=0
proptim2=timer
clr propcount2
endif
inc propcount2
return
procedure prop
print at(3,1);chr$(27);"[2KProp: ";propcount;" ";timer;" ";myprop,"Rate: ",int(10*propcount/(timer-proptim))/10;" Hz"
if (propcount mod 100)=0
proptim=timer
clr propcount
endif
inc propcount
return
HPMAGEN=0
MYPROP=0
MYPROP2=0
clr count%
status$=space$(100)+"Hallo ja ja j aj aj aj ajajaajajajajaj"
clr propcount,propcount1,propcount2
tinemonitor "SENDER[MYPROP]",prop
tinemonitor "SENDER[COUNT%]",np
tinemonitor "SENDER[BEAT]",bbb
tinemonitor "SENDER[STATUS$]",status
do
tinecycle
loop
procedure np
print at(10,10);chr$(27);"[2K";count%
return
procedure bbb
print at(12,10);chr$(27);"[2K";100-propcount,100-propcount1,100-propcount2
clr propcount,propcount1,propcount2
return
procedure status
print at(13,10);chr$(27);"[2K Status:";status$
return
procedure ttt
print "Hallo",timer
return
procedure enc
print "Energie: ",timer,hpmagen
return
procedure prop1
print at(1,1);chr$(27);"[2KProp1: ";propcount1;" ";timer;" ";myprop1,"Rate: ",int(10*propcount1/(timer-proptim1))/10;" Hz"
if (propcount1 mod 100)=0
proptim1=timer
clr propcount1
endif
inc propcount1
return
procedure prop2
print at(2,1);chr$(27);"[2KProp2: ";propcount2;" ";timer;" ";myprop2,"Rate: ",int(10*propcount2/(timer-proptim2))/10;" Hz"
if (propcount2 mod 100)=0
proptim2=timer
clr propcount2
endif
inc propcount2
return
procedure prop
print at(3,1);chr$(27);"[2KProp: ";propcount;" ";timer;" ";myprop,"Rate: ",int(10*propcount/(timer-proptim))/10;" Hz"
if (propcount mod 100)=0
proptim=timer
clr propcount
endif
inc propcount
return
HPMAGEN=0
MYPROP=0
MYPROP2=0
tineserver "rule",56
clr propcount
tinelisten MYPROP,prop
do
tinecycle
loop
procedure prop
myprop1=myprop
tinebroadcast myprop1
inc propcount
return
HPMAGEN=0
MYPROP=0
MYPROP2=0
tineserver "rule2",59
clr propcount
tinelisten MYPROP1,prop
do
tinecycle
loop
procedure prop
myprop2=timer-myprop1
tinebroadcast myprop2
inc propcount
return
clr count%,beat
tineserver "sender",12
do
myprop=timer
tinebroadcast myprop
tinebroadcast count%
if (count mod 100)=0
inc beat
tinebroadcast beat
status$=time$+space$(100)+time$+space$(1000)
tinebroadcast status$
endif
tinecycle
inc count
loop
clr count%,beat
tineserver "SENDER",12
tineexport myprop,count%,beat,status$
do
myprop=timer
tinedeliver myprop
tinedeliver count%
if (count% mod 100)=0
inc beat
tinedeliver beat
status$=time$+space$(100)+time$+space$(1000)
tinedeliver status$
endif
tinecycle
inc count%
loop
' tine server. Sample how to export variables.
' The time between two tinecycles must not exceed 50ms
' (c) Markus Hoffmann 2005-2006
tineserver "TINEGATE"
t$="Hallo"
a=3
b=5
c=7
tineexport a,b,c,t$
do
print a,b,c
for i=0 to 30
pause 0.01
tinecycle
next i
loop
......@@ -4,18 +4,11 @@
#define FALSE 0
#define TRUE (!FALSE)
#define PI 3.141592654
#define E 2.718281828
char version[]="1.01";
const char version[]="1.02";
char ifilename[100]="input.txt";
int b[3000];
int stat[256];
int n=200;
int doauto=FALSE;
double anfang=-.6;
double ende=.6;
char *buffer;
char old[20];
int intellig=4;
......@@ -37,9 +30,7 @@ void intro(){
printf("* BRABBEL V. %s *\n",version);
printf("* von Markus Hoffmann 1997 *\n");
printf("* *\n");
printf("* *\n");
printf("* Programmversion vom 11.01.2006 *\n");
printf("* *\n");
printf("***************************************************************\n\n");
}
......@@ -59,41 +50,32 @@ int irandom(int m) { return((random() & 0xffff)*m/0x10000); }
char getbest(){
int best,i,sum=0,zu;
for(i=0;i<256;i++) sum+=stat[i];
/*for(i=0;i<256;i++) printf("[%d] ",stat[i]);*/
if(sum==0) { printf("\n");
fprintf(stderr,"\n SUMERROR <%s>\n",old);
strncpy(old,buffer,intellig);
return(buffer[intellig]);
}
zu=irandom(sum);
for(i=0;i<256;i++) {
zu-=stat[i];
if(zu<0) return(i);
}
fprintf(stderr,"ERROR\n");
return(-1);
if(sum==0) {
printf("\n");
fprintf(stderr,"\n SUMERROR <%s>\n",old);
strncpy(old,buffer,intellig);
return(buffer[intellig]);
}
zu=irandom(sum);
for(i=0;i<256;i++) {
zu-=stat[i];
if(zu<0) return(i);
}
fprintf(stderr,"ERROR\n");
return(-1);
}
void dostat() {
char *pos;
/*printf("[[[%s]]]\n",old);*/
pos=strstr(buffer,old);
if(pos>buffer+laenge-intellig) printf("\n Text ist auf das Ende gelaufen.\n");
while(pos && pos<buffer+laenge) {
/*printf("%d\n",pos[0]);*/
stat[(unsigned int)pos[intellig] & 0xff]++;
/* printf("dostat: <%x> <%s> <%c>",pos,old,pos[intellig]);*/
pos=strstr(pos+1,old);
}
return;
pos=strstr(buffer,old);
if(pos>buffer+laenge-intellig) printf("\n Text ist auf das Ende gelaufen.\n");
while(pos && pos<buffer+laenge) {
stat[(unsigned int)pos[intellig] & 0xff]++;
pos=strstr(pos+1,old);
}
}
......@@ -102,34 +84,29 @@ long lof( FILE *n) {
position=ftell(n);
if(fseek(n,0,2)==0){
laenge=ftell(n);
if(fseek(n,position,0)==0)return(laenge);
else return(-1);
} else return(-1);
if(fseek(n,position,0)==0) return(laenge);
}
return(-1);
}
main(int anzahl, char *argumente[]) {
FILE *dptr,*dptr2;
float se;
char string[2];
char zeile[100],dummy[50],zz[80];
int i,j=0,k,count;
FILE *dptr;
char best;
int i,j=0,count;
if(anzahl<=2) {intro(); usage(); return(0);} /* zu weinig Parameter */
init(anzahl, argumente); /* Kommandozeile einlesen */
srandom(200);
dptr2=fopen(ifilename,"r");
laenge=lof(dptr2);
dptr=fopen(ifilename,"r");
laenge=lof(dptr);
printf(" %s %d [",ifilename,laenge);
buffer=malloc(laenge+1);
j=fread(buffer,1,laenge,dptr2);
fclose(dptr2);
j=fread(buffer,1,laenge,dptr);
fclose(dptr);
printf("] %d\n",j);
buffer[laenge+1]=0;
strncpy(old,buffer,intellig);
......@@ -137,10 +114,10 @@ main(int anzahl, char *argumente[]) {
for(count=0;count<alaenge;count++) {
for(i=0;i<256;i++) stat[i]=0;
dostat();
string[0]=getbest();
best=getbest();
for(i=1;i<intellig;i++) old[i-1]=old[i];
old[intellig-1]=string[0];
printf("%c",string[0]);
old[intellig-1]=best;
printf("%c",best);
}
free(buffer);
}
' INTENTION as defined (c) Markus Hoffmann 2006
name$="global"
commandparm$="global.cmd_dc"
statusparm$="global.state_dm"
' Here the Transitionmatrix is defined.
' "nop" means: no action
' "-" means: forbidden or impossible transition
' procedure names starting with "i" are internal
' procedure names starting with "p" are derived from other intentions
n=4 ! Number of States
t$()=["nop","p1","-","-";"p2","nop","p3","-";"p4","p5","nop","p6";"p7","p8","-","nop"]
' Here the inverse Lengthes of internal procedures is defined
in=0 ! number of internal procedures
ilen()=[]
' Here the actions for the p-Functions are defined:
pn=8
paction$()=["nop","vacuum(5);timing(4);rf(3)","","","","","",""]
' they are dined as a ";" separated list of other intentions, like
' vacuum(5) means the vacuum subsystem should be in state 5
depth=0
print "von 0 nach 1:"
print @path$(0,1)
print "von 0 nach 2:"
print @path$(0,2)
print "von 0 nach 3:"
print @path$(0,3)
print "von 3 nach 0:"
print @path$(3,0)
quit
function path$(a,b)
local i,z,c$,g$,a$,b$
z=0
c$=""
if a=b
return "(nop)"
endif
if depth>2*n+1
' "Recursion depth too high. There must be a loop!"
return "(end)"
endif
inc depth
for i=0 to n-1
if t$(a,i)<>"-" and a<>i
if i<>b
g$=@path$(i,b)
while len(g$)
split g$,chr$(10),0,a$,g$
b$="("+str$(a)+"--"+t$(a,i)+"-->"+str$(i)+")"+a$
if @checkloop(b$)=0
if len(c$)
c$=c$+chr$(10)
endif
c$=c$+b$
inc z
endif
wend
else if i=b
if len(c$)
c$=c$+chr$(10)
endif
c$=c$+"("+str$(a)+"--"+t$(a,i)+"-->"+str$(i)+")"
inc z
endif
endif
next i
dec depth
return c$
endfunction
function checkloop(t$)
local a$,b$,i,f,loo,count
dim cl(n)
arrayfill cl(),0
loo=0
count=0
t$=left$(t$,len(t$)-1)
t$=right$(t$,len(t$)-1)
while len(t$)
split t$,")(",0,a$,t$
if a$<>"end"
split a$,"--",0,b$,a$
i=val(b$)
split a$,"-->",0,b$,a$
f=val(a$)
if count=0
cl(i)=1
endif
if cl(f)=1
loo=1
endif
cl(f)=1
inc count
endif
wend
return loo
endfunction
function lengthofpath(t$)
return
endfunction
function lengthoftransition()
endfunction
function lengthofexternalaction
endfunction
' Seltsamer Attraktor von Henon
mmm=10000
dim dx(mmm)
dim dy(mmm)
schwarz=get_color(0,0,0)
weiss=get_color(65535,65535,65535)
clearw
x=0.5
y=0.5
c=0
color weiss
for c=0 to mmm
ox=x
x=y+1-1.4*x^2
y=0.3*ox
dx(c)=x
dy(c)=y
next c
sx=320
sy=200
px=320
py=200
do
clearw
scope dy(),dx(),1,sy,py,sx,px
vsync
mouseevent ox,oy,ok
print ok
if ok
if ok=4
sub py,16
else if ok=5
add py,16
else
motionevent
mouse x,y,k
if k=2 and abs(x-ox)<10 and abs(y=oy)<10
add sx,x-ox
add sy,y-oy
else if k=1 and abs(x-ox)<10 and abs(y=oy)<10
add px,x-ox
add py,y-oy
endif
endif
endif
loop
#!/usr/bin/xbasic
' Test cgi-script with X11-Basic (c) Markus Hoffmann
print "Content-type: text/html"+chr$(13)
print ""+chr$(13)
flush
print "<html><head><TITLE>File upload CGI</TITLE><head><body>"
print "<h1>Uploading...</h1>"
print "<pre>"
print "Length=";val(env$("CONTENT_LENGTH"))
flush
length=val(env$("CONTENT_LENGTH"))
while length>1024
t$=t$+@input$(1024)
sub length,1024
wend
if length
t$=t$+@input$(length)
endif
print "got: ";len(t$);" Bytes."
print "</pre>"
r$=env$("REMOTE_ADDR")
h$=env$("REMOTE_HOST")
open "A",#1,"/tmp/WEBfileupload.log"
print #1,date$+" "+time$+" "+r$+" "+h$
print #1,t$
close #1
print "<h1>finish!</h1>"
print "<h3>Another upload:</h3>"
print "<form action=/cgi-bin/fileupload.cgi enctype=multipart/form-data method=post>"
print "Choose a file from your local path:<br>"
print "<input name=Datei type=file size=50 maxlength=100000 accept=text/*>"
print "<INPUT type=submit value=send>"
print "<input type=reset value=clear>"
print "</FORM>"
print "<hr><h6>(c) Markus Hoffmann cgi with X11-basic</h6></body></html>"
flush
quit
function input$(ll)
local i,g$
g$=""
for i=0 to ll-1
g$=g$+chr$(inp(-2))
next i
return g$
endfunc
......@@ -4,6 +4,7 @@
3517 Feb 15 2003 <a href="brabbel.cgi">brabbel.cgi</a>
853 Nov 3 19:45 <a href="envtest.cgi">envtest.cgi</a>
2492 Feb 15 2003 <a href="formtomail.cgi">formtomail.cgi</a>
2492 Feb 15 2005 <a href="fileupload.cgi">fileupload.cgi</a>
2510 Feb 15 2003 <a href="mandel.cgi">mandel.cgi</a> <a href="../../../screenshots/mandelcgi.png">(Screenshot)</a>
886 Feb 15 2003 <a href="mandelgif.cgi">mandelgif.cgi</a>
1092 Feb 15 2003 <a href="mandelposter.cgi">mandelposter.cgi</a>
......
' This program creates the scales for Wall-clocks.
' (c) Markus Hoffmann 2006
'
clocksize=80 ! Radius in mm
figfilename$=""
psfilename$=""
version$="1.06"
@ps_init("Bobouhr.fig")
@ps_dicke(1)
@ps_angle(0)
@ps_color(0)
@ps_circle(80,80,80,80)
@ps_pcircle(80,80,1,1)
@ps_font(22)
@ps_groesse(45)
@ps_tmode(1)
for i=1 to 12
@ps_text(80+45*sin(2*pi*i/12),85-45*cos(2*pi*i/12),str$(i))
next i
for i=1 to 60
if (i mod 5)=0
@ps_dicke(3)
else
@ps_dicke(1)
endif
@ps_line(80+55*sin(2*pi*i/60),80-55*cos(2*pi*i/60),80+60*sin(2*pi*i/60),80-60*cos(2*pi*i/60))
next i
@ps_dicke(2)
for i=1 to 12
@quadrupol(80+72*sin(2*pi*i/12),80-72*cos(2*pi*i/12),2*pi*i/12)
next i
@ps_close
quit
system "fig2dev -L ps -z A4 -c "+figfilename$+" "+psfilename$
' system "rm "+figfilename$
system "chmod 666 "+psfilename$
procedure quadrupol(mx,my,ori)
local i
dim px(15)
dim py(15)
' polyline
px(0)=-5
py(0)=-6
px(1)=5
py(1)=-6
px(2)=5
py(2)=6
px(3)=-5
py(3)=6
px(4)=-5
py(4)=-6
px(5)=-5
py(5)=-4
px(6)=-5
py(6)=4
px(7)=5
py(7)=-4
px(8)=5
py(8)=4
@ps_dicke(1)
for i=0 to 14
ccx=cos(ori)*px(i)-sin(ori)*py(i)
ccy=sin(ori)*px(i)+cos(ori)*py(i)
px(i)=ccx
py(i)=ccy
next i
@ps_dicke(2)
@ps_pcircle(mx+px(5),my+py(5),2,2)
@ps_pcircle(mx+px(6),my+py(6),2,2)
@ps_pcircle(mx+px(7),my+py(7),2,2)
@ps_pcircle(mx+px(8),my+py(8),2,2)
print #1,"2 1 0 "+str$(dicken)+" "+str$(colorn)+" 7 0 0 -1 0.000 0 0 -1 0 0 5"
for i=0 to 4
print #1," "+str$(int(45*px(i)+45*mx))+" "+str$(int(45*py(i)+45*my));