rejetto forum

Macros

Mars · 231 · 81801

0 Members and 1 Guest are viewing this topic.

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile
you could, with the macro i just told


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1985
    • View Profile


my {.min build|183}  or   {.min build|183|alert-text.} is a shortcut of

{.if|{.and|{.match|127.0.0.1|%ip%.}|{.%build%<183.}.}|alert-text.}

Code: [Select]
if (name ='min build') then
  begin
  result:=''; 
  if addressmatch('127.0.0.1',md.cd.conn.address) then
    if par(1)>'' then result:=par(1)
                 else msgdlg('This template requires at least the build version '+p+' of hfs to work completely');
  end;


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile
this is a feature used only once and only in few templates.
i don't think we need a shortcut.


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
is there a new bug in the for loop from build 179 to 183? or changed sintax?
loopvar seems to have always final value!

with build #179:
{{for|ii|1|8|{{\[{{^ii}}]/}}}}  works

output:  [1][2][3][4][5][6][7][8]

with build #183:
{.for|ii|1|8|{:[{.^ii.}]:}.} does not work

output: [8][8][8][8][8][8][8][8]

hfs or my error ?
« Last Edit: March 08, 2008, 09:46:23 AM by bacter »
your computer has no brain - use your own !


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile

Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
rejetto,  thanks for that fast reply
your computer has no brain - use your own !


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1985
    • View Profile
Quote
Insert Quote
bug
fixed in next build

macro FOR EACH has the same bug

I am happy , i found where was the bug :D

theVar:=format('{{^%s}}',[p]);    into functions: for_ () and foreach()

repaced by theVar:=format(MARKER_OPEN +'^%s'+MARKER_CLOSE,[p]);   
« Last Edit: March 07, 2008, 09:02:04 PM by mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile
yes, i fixed foreach as well
but i will wait to publish, to collect some more news


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile
macros' syntax just doesn't allow spaces before the name of the macro.
this is always true except for infix operators like {. 3 >  2 .}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile
i didn't mean what the code does or not.
i meant what's the expected syntax, and what you can expect to be working correctly now and in the future.
the trim is there because spaces are allowed after the name.

anyway, at the moment there's no important reason for this rule, but i think we can ignore the problem of space^var.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1985
    • View Profile
I remove what I said,  'for i:=1 to -1 do msgdlg( inttostr(i));' is never executed in the delphi language

i am deleting all my post about this subject


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
Would it be possible to add a new simple macro {.hex|xx.} ?

This would be useful for me when working with plaintext files to detect or replace the linebreaks.

examples: (csv holds the whole text loaded}

{.count substring |{.hex|0d.}{.hex|0a.}|{.^csv.}.}   to count lines

or:

{.replace|{.hex|0d.}{.hex|0a.}|<br />|{.^csv.}.} to insert line breaks
your computer has no brain - use your own !


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile
no sorry, that solution cannot be.

what i can do is to preserve spaces in {.replace.} and {.count substring.}
the problem is a feature: for the user's convenience macros ignore blanks.
some macros don't, because blanks can be useful, so i can just add these to the list.
i will if no one complains.

for readability you can
Code: [Select]
{.set|nl|{:
:}.}
and then use (in next build) {.replace|{.^nl.}|<br>|{.^csv.}.}
« Last Edit: March 08, 2008, 01:50:06 AM by rejetto »


Offline Andrew-Sirius

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Is it possible on base HFS to make the guest book? So that the records in it would remain in the machine, in which was established HFS.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13260
    • View Profile
if they made a shoutbox, you can make a guestbook