English
Forum

Array and nProc

 

Andreas
Koch
Hello together,

here has by me one small trouble with the Übergabe one Arrays on a nProc yield.

and of course comes each Time the attached Error Message (Application Crash), after the first Result ausgedruckt watts. can someone explain, I there wrong make?
CompileMarkSeparation
CLS
Declare HuckleberryFinn![], Tom!, Sawyer!
HuckleberryFinn![1]=1
HuckleberryFinn![2]=3
Tom!=1
Sawyer!=3

nproc Test1

    Parameters HuckleberryFinn![]
    Declare Ergebnis!
    Ergebnis!=HuckleberryFinn![1]+HuckleberryFinn![2]
    Return Ergebnis!

EndProc

nproc Test2

    Parameters a!,b!
    Declare Ergebnis!
    Ergebnis!=a!+b!
    Return Ergebnis!

EndProc

Print Test2(Sawyer!,Tom!)
Print Test1(HuckleberryFinn![])
Waitinput

243 kB
Hochgeladen:08/30/12
Downloadcounter46
Download
 
08/30/12  
 




Nico
Madysa
so far I know, can Arrays not on NProcs transfer go. only reaches#, Strings$, Longs& and Floats! are allows.
 
08/30/12  
 



Please see Datentypen: [...] 

Nativ go (How of Nico already erwähnt) Strings, Floats & Longs supported.

If you a Wertekette How Arrays transfer want then fetch you simply

a memory z.B. by globalAlloc:
CompileMarkSeparation
var meinSpeicher&=globalAlloc(gPTR,20)// 20 Byte Speicher reservieren und Handle in meinSpeicher& merken
>

and lay there into your values:
CompileMarkSeparation
long meinSpeicher&,0=10,20,30,40,50
>

One Long needed in memory 4 byte and a Float 8 -

5 Floats into memory lay means so:
CompileMarkSeparation
//speicher holen
var meineFloats&=globalAlloc(gPTR,5*8)
//floatwerte in den Speicher legen
float meineFloats&,0=1.1,2.2,3.3,4.4,5.5
//speicher an nProc übergeben
print myNProc(meineFloats&)
//speicher freigeben
globalFree(meineFloats&)
waitinput
end

nProc myNProc

    parameters meineFloats&
    //irgendwas mit floats machen... geben wir einfach z.B. den 4. Floatwert zurück
    return getFloat(meineFloats,8*3)

08/30/12  
 




Andreas
Koch
thanks for response.

then have I iFs Posting here well something wrong interprets.

[...] 
 
08/30/12  
 



whom Posting very?
 
08/30/12  
 




Nico
Madysa
Presumably whom here: [...]  because it therein so sound, as should one only the Schlüsselwort "proc" through "nproc" supplant and everything would knorke.
 
08/30/12  
 




Andreas
Koch
open stood, had You only in keinem your Posts written, that with the Arrays none goes. I had the so interprets, that it too with Arrays functions (and me already gefreut...). really had I it from the last Posting entnehmen can, me was by then only yet never noticed, that one on APIs no Arrays commit. but presumably wanted You me there very the communicating, what now To this Topic here led has.
Sorry for circumstances. be sometimes bisschen heavy of concept.
 
08/30/12  
 



understand. the here once durchlesen: [...]  -

its quasi one very very simple Profan but even as Support To XProfan

with all positive properties one nativen Profans.


open stood, had You only in keinem your Posts written, that with the Arrays none goes.


Yes, simply because the "soooo" indeed not integrally is correct, because even if The aray-

spelling not is used, so are Arrays Yes Datenketten and these against

are slight by memory anzufertigen and against too slight with nProcs

verwertbar. I had attempts for 1-2 Examples To give. If you not weiterkommst

then simply fix report because then basteln we the together.
 
08/30/12  
 




funkheld
Error Message:
meineFloats undeklariert....

greeting
 
08/30/12  
 



certainly because I one Undzeichen forget have:

getFloat(meineFloats&,8*3)

How written simply into editor here typed
 
08/30/12  
 




Andreas
Koch
Sorry people, i'm again steckengeblieben.
now have I The Arrays![] in reaches# transformed and the transfer, so far so well. it shining too with Procs correctly. To calculate.
but with nProcs beschwert it itself in the procedure DreiecksmatrixTest first, that FHG% and Anzahl_Lastfaelle% not declared seien (though The still with transfer go). If I The deklariere, I get subsequently a seltsame Error Message, see Appendix.
CompileMarkSeparation
Window 800,800
var Size%=6
Declare A#, Zeile&, Spalte&, Diagonale&, Faktor!, aux!,L#,Lastfall%,V#
DIM A#,Size%*Size%*8
DIM L#,Size%*8
DIM V#,Size%*8
Lastfall%=0
'Erzeugung zweier Zufallsmatrizen

WhileLoop 0,Size%-1

    Spalte&=&loop

    WhileLoop 0,Size%-1

        Zeile&=&loop
        SMAT(A#,Size%,Spalte&,Zeile&,1+Rnd())

        If Spalte&<1

            SMAT(L#,Size%,Spalte&,Zeile&,1+Rnd())

        EndIf

    EndWhile

EndWhile

'Umformung, Erzeugung einer Dreiecksmatrix

nproc DreiecksmatrixTest

    Parameters A#, L#, FHG%, Anzahl_Lastfaelle%
    Declare Diagonale&,Zeile&,Lastfall&,Faktor!,Spalte&, aux!, FHG%, Anzahl_Lastfaelle%

    WhileLoop 0,(FHG%-1),1

        Diagonale&=&loop

        WhileLoop Diagonale&+1,FHG%-1,1

            Zeile&=&loop
            '      WaitInput
            Faktor!=LMAT(A#,FHG%,Diagonale&,Zeile&)/LMAT(A#,FHG%,Diagonale&,Diagonale&)

            if Faktor!<>0

                WhileLoop 0,Anzahl_Lastfaelle%-1

                    Lastfall&=&loop
                    aux!=LMAT(L#,FHG%,Lastfall&,Zeile&)-Faktor!*LMAT(L#,FHG%,Lastfall&,Diagonale&)
                    SMAT(L#,FHG%,Lastfall&,Zeile&,aux!)

                EndWhile

                WhileLoop 0,FHG%-1,1

                    Spalte&=&loop
                    aux!=LMAT(A#,FHG%,Spalte&,Zeile&)-Faktor!*LMAT(A#,FHG%,Spalte&,Diagonale&)
                    SMAT(A#,FHG%,Spalte&,Zeile&,aux!)

                EndWhile

            EndIf

        EndWhile

    EndWhile

EndProc

nProc LMAT

    Parameters Bereich#, Size%, Spalte& , Zeile&
    Declare Result!
    Result!=Float(Bereich#, (Spalte&*Size%+Zeile&)*8)
    '  Print "Spalte&",Spalte&,"Zeile&",Zeile&, ": ", Result!
    Return Result!

EndProc

nProc SMAT

    Parameters Bereich#, Size%, Spalte&, Zeile&,Wert!
    ' Locate 1,1
    ' Print "Spalte&",Spalte&,"Zeile&",Zeile&,": ",Wert!
    Float Bereich#,(Spalte&*Size%+Zeile&)*8=Wert!

EndProc

'Rücksubstitution

nProc SolverTest

    Parameters Lastfall&, A#,L#, V#, FHG%
    Declare aux!, Zeile&, Spalte&, Diagonale&

    WhileLoop FHG%,1,-1

        Diagonale&=&loop-1
        aux!=0

        WhileLoop Diagonale&+1,FHG%-1,1

            Spalte&=&loop
            aux!=aux!+LMAT(A#,FHG%,Spalte&,Diagonale&)*LMAT(V#,FHG%,Lastfall&,Spalte&)

        EndWhile

        aux!=(LMAT(L#,FHG%,Lastfall&,Diagonale&)-aux!)/LMAT(A#,FHG%,Diagonale&,Diagonale&)
        SMAT(V#,FHG%,Lastfall&,Diagonale&,aux!)

    EndWhile

EndProc

DreiecksmatrixTest(A#, L#, Size%, 0)
SolverTest(0,A#,L#, V#, Size%)

WhileLoop 0,Size%-1

    Print LMAT(V#, Size%,0, &loop)

EndWhile

WaitInput
Dispose L#, V#, A#

have a little bit patience with me, I work not yet such a long time with Profan....

167 kB
Hochgeladen:08/31/12
Downloadcounter49
Download
 
08/31/12  
 



No worry, there's In any drop sufficient patience present.

You verwendest into nProcs Integer ( % ) -

in nProcs there Longs ( & ), Floats ( ! ) and Strings ( $ ) -

use means instead of the Integer ( % ) The Longs ( & ).

The nProcs are manchen Things something pingeliger -

so must Float-Konstanten always with Dezimaltrenner/ point

ausgeschrieben go.

Z.B. 1.0 instead of 1 or 0.0 instead of 0.

You write: if factor!<>0 instead of if factor!<>0.0

therefore bleats XPSE the Long given is ( The 0 ) but Float expects becomes

in the function dreiecksmatrixtest.

You write in the nProc SMAT: Parameters area#, should but area&

heissen.

hint: but not Float area#,(Spalte&*Size%+Zeile&)*8=Wert! what but
Float area&,(Spalte&*Size%+Zeile&)*8=Wert! heissen should in nProcs rather
setFloat(Bereich&,(Spalte&*Size%+Zeile&)*8,worth!) write.

too into others Procs The Memory-Variables instead of with # with & write.
 
08/31/12  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.370 Views

Untitledvor 0 min.
rafl12/26/20
Georg Teles02/13/16
Andreas Koch09/08/15
Peter Max Müller10/10/14
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie