plusieurs argument retourné des procedures
plusieurs argument retourné des procedures
hello !
....----->
....----->
Last edited by dobro on Fri Jun 22, 2007 11:34 am, edited 1 time in total.
rather as in OMIKRON BASIC to make precede the variables by return of a “R” to announce to it this variable is used of parameter and variable of return!! as follows
example
in omikron BASIC to recover several value it is enough to make precede the variables by parameters by the procedure by the letter " R "
en omikron basic pour recuperer plusieurs valeur il suffit de faire preceder les variables de parametres de la procedure de la lettre" R"
comme ça :
on defini la procedure :
le prg qui utilise la procedure :
deviennent apres l'appel de la procedure
x=6 et y=7 !!!
bien sur le nombre de paramètres retournés, correspond au nombre de paramètre précédé d'un R
(well on the number of turned over parameters, corresponds to the number of parameter preceded by one R )
example
in omikron BASIC to recover several value it is enough to make precede the variables by parameters by the procedure by the letter " R "
en omikron basic pour recuperer plusieurs valeur il suffit de faire preceder les variables de parametres de la procedure de la lettre" R"
comme ça :
on defini la procedure :
DEF PROC plus_court (Rcpt, Rnom)
LOCAL i,gt : rem 2 variable locales
FOR i = max(cpt,nom) to 1 STEP -1
IF frac(cpt/i)=0 AND frac(nom/i)=0 THEN gt=i:EXIT
NEXT i
cpt=cpt/gt:nom=nom/gt
RETURN
le prg qui utilise la procedure :
les x=36 et y=42x=36:y=42
plus_court(x,y):REM pas besoin de metre les 'R' pour l'appel des procedures
PRINT x,y
deviennent apres l'appel de la procedure
x=6 et y=7 !!!

bien sur le nombre de paramètres retournés, correspond au nombre de paramètre précédé d'un R
(well on the number of turned over parameters, corresponds to the number of parameter preceded by one R )
Salut dobro,
C'est pas çà que tu cherche ?
C'est pas çà que tu cherche ?
Code: Select all
Procedure p(*a.LONG,*b.LONG)
*a\l = 10
*b\l = 10
EndProcedure
OpenConsole()
a = 20
b = 30
p(@a,@b)
PrintN("a="+Str(a))
PrintN("b="+Str(b))
Input()
CloseConsole()
If I understood your post correctly, which was very hard to do, I think you are talking about being able to use pointers. This feature is already in purebasic using the @symbol
edit: looks like someone beat me to it 
Code: Select all
Procedure test(x,y)
PokeL(x,100)
PokeL(y,200)
EndProcedure
x = 10
y = 50
test(@x,@y)
debug x
debug y

mais c'est lourding non ? ::: but it is heavy not?
exemple en purebasic ::: example in purebasic
and in Omikron BASIC
si cette syntaxe existais en purebasic, quelle confort non ? ::: if this syntax existed in purebasic, which comfort not?
Fred ce serai possible ou pas ?
[Reedit !]
Flype m'a donné un code qui correspond mieux !!
plus clair et simple
::: Flype gave me a code which corresponds better!! : D clearer and simple
exemple en purebasic ::: example in purebasic
Code: Select all
Procedure divise_par_deux(x,Y)
x2=PeekL(x)/2
y2=PeekL(Y)/2
PokeL(x,x2)
PokeL(Y,y2)
EndProcedure
CallDebugger
x = 10
Y = 50
divise_par_deux(@x,@Y)
Debug x
Debug Y
and in Omikron BASIC
Procedure divise_par_deux(Rx,RY)
x=x/2
Y=Y/2
EndProcedure
x=10
Y=20
divise_par_deux(x,Y)
----> Resultat
x=5
Y=10
si cette syntaxe existais en purebasic, quelle confort non ? ::: if this syntax existed in purebasic, which comfort not?

Fred ce serai possible ou pas ?

[Reedit !]
Flype m'a donné un code qui correspond mieux !!

plus clair et simple

Code: Select all
Procedure divise_par_deux(*x.Long, *y.Long)
*x\l / 2
*y\l / 2
EndProcedure
CallDebugger
x = 10
Y = 50
divise_par_deux(@x, @Y)
Debug x
Debug Y
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
it would be SHEER HORROR!if this syntax existed in purebasic, which comfort not?
what if I wanted to use a parameter-name starting with an "R"?
what would happen in Omikron-Basic?Procedure Calculation( Angle, Radius )
ProcedureReturn Sin(Angle * #PI / 180) * Radius
EndProcedure
1. would it produce an error, because there is no upper variable called adius?
2. would it produce an error, because the local variable Radius isn't declared?
using a simple letter for a classification is anything else but productive!
special caracters can be used for classifications,
as is the @ for the adress or the * for a pointer.
it is fine the way it is.
oh... and have a nice day.
Kaeru Gaman wrote: what if I wanted to use a parameter-name starting with an "R"?Procedure Calculation( Angle, Radius )
ProcedureReturn Sin(Angle * #PI / 180) * Radius
EndProcedure
cela aurai pu etre R_ au lieu de R :::::that could have been R_ instead of R
ce qui donnerai :::what will give :
il y a toujours un moyen de trouver une convention:::it is possible always to find a conventionProcedure Calculation( Angle, R_Radius )
ProcedureReturn Sin(Angle * #PI / 180) * Radius
EndProcedure

using a simple letter for a classification is anything else but productive!
special caracters can be used for classifications,
as is the @ for the adress or the * for a pointer.
it is fine the way it is.
effectivement :::: indeed

d'ailleurs mon dernier exemple fourni par Flype le démontre:::
moreover my last example provided by Flype shows it
enfin c'etait une idée ::::finally it was an idea

Sorry for the non-french speaking people
Go to learn a new language ... french 
Dobro, tu dois surement vouloir une syntaxe de ce type :
Cet exemple est en FreeBasic. PureBasic n'a que des passages de paramètres par valeur. Tu dois explicitement passer l'adresse d'une variable pour simuler le passage de référence. Peut-être que dans la version 5 nous aurons le passage par ref. si nous sommes suffisament nombreux à le demander .....
Mais cette modification n'est pas anodine pour le compilateur.


Dobro, tu dois surement vouloir une syntaxe de ce type :
Code: Select all
Sub Divise_par_2(ByRef a As Integer,ByRef b As Integer)
a /= 2
b /= 2
End Sub
Dim a As Integer
Dim b As Integer
a = 20
b = 50
Divise_par_2(a,b)
Print " a = ",a
Print " b = " ,b
sleep
Mais cette modification n'est pas anodine pour le compilateur.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
well, an Underscore is also a legal part of a Variable name.that could have been R_ instead of R
I can define a Variable like Master_Of_Puppets.l or anything I like.
therefor again, it is not praktiable to use chars that are legal for variables to classify anything.
> it is possible always to find a convention
sure, not usings legal chars for classifying..

> moreover my last example provided by Flype shows it
so, now that you know how to do it in PB, I think you will not need any "R_" stuff anymore...

> Go to learn a new language ... french
Wieviele Sprachen soll ich denn dann lernen?
Eigentlich wuerde mich eher Spanisch oder Italienisch interessieren,
und wenn ich sehr viel Zeit haette, wuerde ich mich um Japanisch bemuehen...
english is really easy enough for everybody, so it's the ideal international conversation language.
oh... and have a nice day.
Bonjour Kaeru Gaman,
I studied German many, many years ago. And you can't imagine how much I regret to not have studied it more and better....
I agree with you on two points :
* we don't need prefixed parameters with special meaning(fred, please never change the compiler this way). I can't imagine how long it will take to verify all code written by all of us to see if all parameters in all functions do not use the special prefix
* English is enough in this forum (even if it's a multicultural one). I gave an answer in french to Dobro because he seems to understand it better.
PS : try to learn Japanese, it's really an amazing language and culture.
I studied German many, many years ago. And you can't imagine how much I regret to not have studied it more and better....
I agree with you on two points :
* we don't need prefixed parameters with special meaning(fred, please never change the compiler this way). I can't imagine how long it will take to verify all code written by all of us to see if all parameters in all functions do not use the special prefix

* English is enough in this forum (even if it's a multicultural one). I gave an answer in french to Dobro because he seems to understand it better.
PS : try to learn Japanese, it's really an amazing language and culture.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
I never learned french in school, thus it's a bit a problem for me.
I can understand 20%-40% of the words, because they have latin roots,
but to get the grammar it's a lot of guessing...
Yes, Japanese is fascinating.
I already know quite a lot about the culture, I even understand some of the more unfamiliar points of the japanese way of thinking...
but I only know few words, fewer grammar, and the charset is a horror... xD
I can understand 20%-40% of the words, because they have latin roots,
but to get the grammar it's a lot of guessing...
Yes, Japanese is fascinating.
I already know quite a lot about the culture, I even understand some of the more unfamiliar points of the japanese way of thinking...
but I only know few words, fewer grammar, and the charset is a horror... xD
oh... and have a nice day.