## computer language

Scope and XITE Development

Original topic on PlanetZ: https://forums.scopeusers.com/viewtopic.php?t=925

####

Posted: Wed Jun 20, 2001 12:53 pm
by spacef
I all,
i'ml rying to find some basic computer language website explaining very basic funstions like ARRAY and stuff like that. also, what a "then else" is supposed to do more than a double If/then circuit ?not)thanks for links or answers.

####

Posted: Thu Jun 21, 2001 1:02 am
by Micha
good book+easy to read: Kernighan/Ritchie: C Programming Language ISBN:0-13-110370-9 (anglais, mais est certainement traduit) original in english is quite amusing to read.
ARRAY: is a chunk of memory sized according to what you need: I need room for max 20 words, longesat not longer than 30 letters -> I form array[20] of char[30] and call it words, so I write in C: char words[20][30]; and get me the 10. of words with words[9], because counting starts with 0 in C. OK?
IF THEN ELSE: IF looks for TRUE. If it finds TRUE it continues with THEN, if not it continues with ELSE. Is like you go to supermarket and look for creme chantilly for your piece of cake: if it's there THEN you'll take it, ELSE you'll, IF it's there THEN take creme fraiche instead, ELSE, bad luck, no cream for the cake. OK?
Happy pulsaring
Micha

####

Posted: Thu Jun 21, 2001 3:42 pm
by spacef
yes it sounds pretty amusing to read hehe,
(j'espère qu'il est traduit)
thanks.

####

Posted: Thu Jun 21, 2001 3:50 pm
by spacef
but the if/then/else of DP looks more different ( what you described : if true then (something) if false then (something else) is already easy to do. there's some mysterious module(s) in there.
unless it means, "if false then "not something else" but "ELSE""(cont.val) (without taking the cream instead)? is that right ?

####

Posted: Fri Jun 22, 2001 12:28 am
by Micha
yes, I suppose. (Tomorrow I go to my dealer and ask him for the programming handbook, have only Pulsar). Made a different view to things:
Proposition:
Program Soundcard
main
{
if( WannaBuyANewSoundcard() )
then GoAndGetIt();
else
SayShit();
return 0; //errors since this program makes no mistakes!
}
Here we go: The OS lists main under the name Soundcard in the taskmanager, that is, it knows the starting point as address in the ram, the place where it loaded it. If looks for TRUE and finds an address to jump to for the answer. The address is an offset from the starting point main, found out by the linker of the program.
- Tools: a program is made by a compiler and a linker. The compiler looks that everything is written well and the linker organizes the compiled parts into an executable program.
At this point the linker will say: Ok, can make starting sequence and finish, but 3 parts are missing, more precise 3 BLOCKs.
First BLOCK named WannaBuyANewSoundcard() must give answer TRUE or FALSE so:
BOOL WannaBuyANewSoundcard()
{
ARRAY Cards[6][15]={"Scope, ProTools, Pulsar, Powercore, Digi001, Oasys"};
NUMBER Money = 1000; // $
NUMBER nCards = 6;
NUMBER counter;
// now for each soundcard check, if possible
for( counter = 0; counter < nCards; counter++ )
{
CheckPrice( Cards[counter], Money );
}
}
So, WannaBuyANewSoundcard() needs a helper:
BOOL CheckPrice( Cardname, Money )
{
ARRAY Cards[6][15]={"Scope, ProTools, Pulsar, Powercore, Digi001, Oasys"};
ARRAY Price[6]={7000, 8000, 1200, 1240, 990, 850};
NUMBER nCards = 6;
NUMBER counter;
// now for each soundcard look if it is the one and compare the price
// if price is less return TRUE
for( counter = 0; counter < nCards; counter++ )
{
if( Cards[counter] == Cardname )
{
if( Price[counter] < Money )
then return TRUE;
else return FALSE;
}
}
}
The program is organized by the linker in startcode, DATA-section, instructions. All ARRAY and NUMBER are lined up in the DATA section so Money, counter etc. are in reality only offsets from main. So the information is open for the OS. So Cards can be found:
main+offsetBLOCK2+offset(there) and/or main+offsetBLOCK3+offset(there).
Pulsar can be found main+offsetBLOCK2+offset+15+15 and/or main+offsetBLOCK3+offset+15+15.
Nobody cares about main+offsetBLOCK2+offset(there), let the linker care, but the +15+15 are useful. So when you say Cards[2] you could also say Cards+15+15. OK?
IF-THEN-ELSE is from this point of view a fork containing 2 Adresses to jump to: THEN-Block and ELSE-Block. Adresses are marked with &. ELSE can be NOP (=nothing to do). (So the compiler puts a NOP in the code at the place of the adress of the ELSE-Block where you should have written else, but did not or the linker fills in the demanded offset) The inner logic of IF is then: TRUE->&THEN, FALSE->&ELSE, -> stands for the Processor-Instruction JUMP. OK?
BTW: CW: Hiding Programmer Handbooks is not so intelligent, as you can see from this thread. Can't help him the way I possibly could.
Happy scoping (in this case)
Micha

####

Posted: Fri Jun 22, 2001 8:44 am
by John Cooper
haha, micha, you're a total geek!
that was great!
so,mehdi, the scope/dp if are quite simple, but don't work quite like the C examples above.
from memory, i think there's a ValIf pad, ValY pad, ValN pad, an In pad and an Out pad.
here's some C-style code, using those padnames:
if (In == ValIf)
Out = ValY;
else
Out = ValN;
typically you just set the ValIf, ValY and ValN pads directly.
let's say you want to output a 6 if the input is 1 and otherwise a 9.
if (in == 1)
out = 6;
else
out = 9;
so set ValIf to 1, ValY to 6, ValN to 9. that's it.
hope this helps,
-john

####

Posted: Fri Jun 22, 2001 10:02 am
by spacef
thanks micha !!!
"ELSE can be NOP (=nothing to do). "
that's what i understood reading you, must betested in DP, I should try, because it's the only difference with the DP-if that acts like "if true: then soundcard 1, if false then soundcardcard 2, but no possibilty to get no soundcard.
but i'll read more than twice your literrature

####

Posted: Fri Jun 22, 2001 10:09 am
by spacef
mm,
John,
actually, i found a module somewhere in DP which is named if/then/else and has pads like
in
var1
op
ntru
dtru
strT
nFal
dFal
ndea
nBs
...etc
i wonder if it allows to switch several conditions to different send value.the current IF (i use them a lot in omix) are if/then/else , else being fixed value to the FAlse condition.
2 conditions, no possibilty to have no condition, or actually, a continuous value (follower) as a send event.

####

Posted: Fri Jun 22, 2001 10:40 am
by John Cooper
oh! didn't see that module. no wonder you're confused!
well, i'm outta here for the weekend. back monday!
-john

####

Posted: Sun Jul 08, 2001 8:45 am
by spacef
In fact i think it's a switch that can output alpha values (for identification/"protection"?). well, should be tested.