service { const html Welcome =

Welcome to use My Wig Test !


You are NO. <[no]> visitor!

Please input your name: ; const html Init =

We are going to initial the number for polling !


Done!!!

; const html InformationInput =

Please input your information here!

First Name:   
Last Name:
Language
Zip/Postal Code:    
Gender: Female Male
; const html ShowInformation =

Please check your information!



Your firstname is: <[firstname]>

Your lastname is: <[lastname]>

Your prefered language is: <[lang]>

Your postal code is: <[post]>

Your gender is <[gender]>



Is your information correct? Yes. That's right. No. I will correct it. ; const html Choose =

Hello, <[name]>


Please choose one:


1. Information Input
2. Tuple Test
3. Poll
4. Quit

; const html ShowSchema1 =

This is for testing tuples!


We have tuple <[message]> which is:

b: <[b]>

i: <[i]>

s: <[s]> ; const html ShowSchema2 =

This is for testing tuples!


We have tuple <[message1]> which is:

b: <[b1]>

i: <[i1]>

s: <[s]>
Now we tranfer it to t2 by keep b and i

So we have tuple <[message2]> which is:

b: <[b2]>

i: <[i2]>

; const html ShowSchema3 =

This is for testing tuples!


We have tuple <[message1]> which is:

b: <[b1]>

i: <[i1]>

s: <[s]>
Now we tranfer it to t3 by throw

s

away
!

So we have tuple <[message2]> which is:

b: <[b2]>

i: <[i2]>

; const html ShowSchema4 =

This is for testing tuples!


We have tuple <[message1]> which is:

b: <[b1]>

i: <[i1]>

s: <[s1]>
tuple <[message2]> which is:

b: <[b2]>

i: <[i2]>
and tuple <[message3]> which is:

b: <[b3]>

s: <[s3]> ; const html ShowSchema5 =

This is for testing tuples!


Now we execute g1= g2<<g3, the result is
and tuple <[message]> which is:

b: <[b]>

i: <[i]>

s: <[s]>

; const html ShowSchema6 =

This is for testing tuples!


This time we use g4=g1<<g2<<g3, the result is
and tuple <[message]> which is:

b: <[b]>

i: <[i]>

s: <[s]>

; const html Poll =

Please choose your favorite picture!

1. Vote for this.

2. Vote for this.

3. Vote for this.

4. Vote for this.

5. Vote for this.

; const html PollResult =

Poll Result


You voted for picture <[pict]>!

<[fav1]> people vote for picture 1

<[fav2]> people vote for picture 2

<[fav3]> people vote for picture 3

<[fav4]> people vote for picture 4

<[fav5]> people vote for picture 5

; const html Byebye =

Byebye <[name]>

; schema Scm1 { bool b; int i; string s; } schema Scm2 { bool b; int i; } schema Scm3 { bool b; string s; } int counter; int fav1,fav2,fav3,fav4,fav5; int incrementCounter() { counter=counter+1; return(counter); } session Access() { string name,lang,firstname,lastname,post,gender,answer; int ch,favor,current_counter; tuple Scm1 t1,g1,g4; tuple Scm2 t2, t3,g2; tuple Scm3 g3; ch=0; favor=0; answer="no"; g1 = tuple { b=false, i=23,s="foo" }; current_counter=incrementCounter(); show plug Welcome[no = current_counter] receive[name=name]; show plug Choose [name=name] receive[ch=choice]; while (ch!=4){ if (ch==1){ while (answer=="no"){ show InformationInput receive[lang=language, firstname=firstname, lastname=lastname, post=post, gender=gender]; show plug ShowInformation [firstname=firstname, lastname=lastname, post=post, lang=lang, gender=gender] receive [answer=correct]; ch=0; } } if (ch==2) { t1 = tuple { b=true, i=87, s="foo" }; show plug ShowSchema1[message = "t1 ", b = t1.b, i = t1.i, s=t1.s]; /* create a new tuple t2, keeping fields b and i, and show it */ t2 = (t1 \+ (b, i)); /* keep b and i */ show plug ShowSchema2[message1 = "t1 ", b1 = t1.b, i1 = t1.i, s=t1.s, message2 = "t2 ", b2 = t2.b, i2=t2.i]; /* create a new tuple t3, throwing away field s, and show it */ t3 = (t1 \- s); /* throw away s */ show plug ShowSchema3[message1 = "t1 ", b1 = t1.b, i1 = t1.i, s=t1.s, message2 = "t3 ", b2 = t3.b, i2=t3.i]; /* create an show g2 */ g2 = tuple { b=true, i=87 }; g3 = tuple { b=false, s="foo" }; show plug ShowSchema4[ message1 = "g1 ", b1 = g1.b, i1 = g1.i, s1= g1.s, message2 = "g2 ", b2 = g2.b, i2 = g2.i, message3= "g3 ", b3 =g3.b, s3=g3.s]; /* combine g2 and g3. g2 and g3 must agree on the types of attributes they have in common. g1 will contain the union of g2 and g3's attributes. g3's attributes are taken whenever there is a common attribute. */ g1 = g2 << g3; /* g1 should be equal to tuple { b=false,i=87,s="foo" } */ show plug ShowSchema5[message = "g1 ",b = g1.b, i = g1.i, s=g1.s]; g2 = tuple { b=true, i=100 }; g3 = tuple { b=false, s="new_foo" }; g4=g1<