RAVEL programming constructs

1. program structure #################################

<constants>
<global data>
<riffs/functions>
<voicelists>

2. constants #################################

BASSDRUM = LC
HOWLONG = 3 * w
MAXUCHAR = 0xff

3. global data  #################################

# 1 dim arrays
uchar foof[10]
int foof2[100]

# 2 dim arrays
uchar foo[2][3]
int foo2[3][10]

# notes
notes notelist1 = {
	C, q, 80,
	D, q+1, 85,
	E, q+2, 90,
}

# initialized data, global data only

uchar glob1[18]={
	C,C,E,G,G,E,E,C,C,
	C,C,E,G,G,E,E,D,D
}
uchar twobytwo[2][2] = {
	1,2,
	3,4
}

4. riff form ###########################

riff wowser(vector foo, size)
end

5. voicelist form ###########################

vco melody
end

6. programming statements ###########################

# if then else forms

if ( x )
end

if ( x )
else
end

if ( x ) 
else if ( y )
else
end

if ( x ) 
else if ( y )
end

# switch - multi-way branch
switch(x)
case 1:
	end
case 2:
	end
case 3..10:
	end
default:
	end
end

# do forever
for (;;)

end

# standard for loop
for (i = 0; i < MAX; i++)
end

# repeat a constant number of times
do
while	100

7. function parameters ###########################

uchar buf[10]

riff printVec(vector a, size)
	int i
	for ( i = 0; i < size; i++)
		void printf("%d ",a[i])
	end
	void printf("\n")
end

vco doit
	void printVec(&buf,10)
end

8. note structure access ####################################

# appears to be 8 by 3 but is actually 3 by 8!
#
notes foof = {
	C, q, 80,
	D, q+1, 85,
	E, q+2, 90,
	F, q+3, 93,
	G, q+4, 97,
	A, q+5, 100,
	B, q+6, 105,
	HC, q+7, 110 
}

vco test
	int col

	for ( col = 0; col < NONOTES; col++)
		void printf("%d %d %d\n",foof[0][col],foof[1][col],foof[2][col])
	end

end
