English
Forum

Hash a function out benefit

 
- Page 1 -



Michael
W.
Have one shelf before the head.
i want still only one Hash-aray a function out benefit. Weder The direct indicated yet The Parameter Passing functions.

who zerdrückt me whom small Krabbler... (erl. )
' Vorgaben :
' Set("HashDel", "|")
' Set("HashListDel", Chr$(254))
' Set("HashMode", 0)  // 0= case sensitive, 1= ignore case
MkDir "C:\\temp"

If %IOResult : Beep : EndIf

    Set("LogFile", "C:\\temp\\XProfanErrorLog.txt")
    LogOut "---start"
    Declare hash TransVars[]
    TransVars["align"] = "\qcenter\q"
    TransVars["valign"] = "\qmiddle\q"
    TransVars["bgcolor"] = "\q#FFFF00\q"
    TransVars["class"] = "\qSmaller\q"
    TransVars["font_color"] = "\q#FF0000\q"
    TransVars["text_1"] = "Eintrag"
    LogOut "hash erzeugt"

    Proc HashTrans

        Parameters hash t_v[], string Text
        Declare string key,value
        LogOut "in hashtrans"
        '   ForEach TransVars[], key, value
        ForEach t_v[], key, value
        LogOut "key= "+ key + ", value= " + value
        Text = Translate$( Text, "{°"+key+}", value )
        EndFor
        LogOut "hashtrans ende"
        Return Text

    ENDPROC

    Cls
    LogOut "hinter Cls"
    Print HashTrans("<td align={°align°} valign={°valign°} bgcolor={°bgcolor°} class={°class°}><font color={°font_color°}>{°text_1°}</font></td>")
    LogOut "hinter the Funktionsaufruf"
    Clear TransVars[]
    LogOut "hinter Clear"
    WaitKey
    Set("LogFile", "")
    End
 
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
03/20/16  
 



« this Posting watts as Solution marked. »


RGH
means with Parameter functions it, if you then too TransVars[] as first Parameter when calling the function angibst:
Print HashTrans(TransVars[],"<td align=....

the others trouble is objectively one solches. If it too solid was, The Schleifenvariablen with FOR / FOREACH as local variables To style (How about in Delphi), so schieße I here möglicherweise a little bit over the target out, if it too the Hash-aray concerns. on the other hand becomes one into most Make, if is a function/procedure writes, The one Hash-aray machine your this too as Parameter transfer.

it would objectively To consider, whether I The constraint on local variables here in the next Version weglasse.

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
03/20/16  
 




Michael
W.
The direct indicated in the Hauptprogramm functions...

means runs there something schief.

If already not as Parameter "hash t_v[]", then should at least the direct appeal "TransVars[]" in the function functions. goes but not.
' Vorgaben :
' Set("HashDel", "|")
' Set("HashListDel", Chr$(254))
' Set("HashMode", 0)  // 0= case sensitive, 1= ignore case
MkDir "C:\\temp"

If %IOResult

    Beep

EndIf

Set("LogFile", "C:\\temp\\XProfanErrorLog.txt")
LogOut "---start"
Declare hash TransVars[]
TransVars["align"] = "\qcenter\q"
TransVars["valign"] = "\qmiddle\q"
TransVars["bgcolor"] = "\q#FFFF00\q"
TransVars["class"] = "\qSmaller\q"
TransVars["font_color"] = "\q#FF0000\q"
TransVars["text_1"] = "Eintrag"
LogOut "hash erzeugt"
Cls
LogOut "hinter Cls"
'Print HashTrans("<td align={°align°} valign={°valign°} bgcolor={°bgcolor°} class={°class°}><font color={°font_color°}>{°text_1°}</font></td>")
'LogOut "hinter the Funktionsaufruf"
var string Text = "<td align={°align°} valign={°valign°} bgcolor={°bgcolor°} class={°class°}><font color={°font_color°}>{°text_1°}</font></td>"
'Proc HashTrans
'   Parameters hash t_v[], string Text
Declare string key,value
LogOut "in hashtrans"
ForEach TransVars[], key, value
'   ForEach t_v[], key, value
LogOut "key= "+ key + ", value= " + value
Text = Translate$( Text, "{°"+key+}", value )
EndFor
LogOut "hashtrans ende"
'   Return Text
'ENDPROC
print Text
LogOut Text
Clear TransVars[]
LogOut "hinter Clear"
WaitKey
Set("LogFile", "")
End
 
XProfan X3
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
03/20/16  
 




RGH
means with Parameter functions it, if you then too TransVars[] as first Parameter when calling the function angibst:
Print HashTrans(TransVars[],"<td align=....

the others trouble is objectively one solches. If it too solid was, The Schleifenvariablen with FOR / FOREACH as local variables To style (How about in Delphi), so schieße I here möglicherweise a little bit over the target out, if it too the Hash-aray concerns. on the other hand becomes one into most Make, if is a function/procedure writes, The one Hash-aray machine your this too as Parameter transfer.

it would objectively To consider, whether I The constraint on local variables here in the next Version weglasse.

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
03/20/16  
 




Michael
W.
I thanks you.

by the many hither and thither have I there objectively what overlooking.

really is the thing with the local variables ok, it asks itself only How the then with very large Hasharrays looks.

here again The funktionsfähige Version.
Declare hash TransVars[]
TransVars["align"] = "\qcenter\q"
TransVars["valign"] = "\qmiddle\q"
TransVars["bgcolor"] = "\q#FFFF00\q"
TransVars["class"] = "\qSmaller\q"
TransVars["font_color"] = "\q#FF0000\q"
TransVars["text_1"] = "Eintrag"

Proc HashTrans

    Parameters hash t_v[], string Text
    Declare string key,value
    ForEach t_v[], key, value
    Text = Translate$( Text, "{°"+key+}", value )
    EndFor
    Return Text

ENDPROC

Cls
Print HashTrans(TransVars[],"<td align={°align°} valign={°valign°} bgcolor={°bgcolor°} class={°class°}><font color={°font_color°}>{°text_1°}</font></td>")
Clear TransVars[]
WaitInput
End
 
XProfan X3
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
03/21/16  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.873 Views

Untitledvor 0 min.
Walter05/10/21
Michael W.07/31/17
derSchu08/12/16
Torsten Rümker05/10/16
More...

Themeninformationen

this Topic has 2 subscriber:

Michael W. (3x)
RGH (1x)


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