home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 March / CMCD0304.ISO / Software / Freeware / Programare / nullsoft / nsis20.exe / Contrib / Math / math.nsi next >
Text File  |  2003-09-15  |  1KB  |  40 lines

  1. ; This is just an example of Math plugin
  2. ; (c) brainsucker, 2002
  3. ; (r) BSForce
  4.  
  5. Name "Math Plugin Example"
  6. OutFile "math.exe"
  7. SetPluginUnload  alwaysoff
  8. ShowInstDetails show
  9. XPStyle on
  10.  
  11. Section "ThisNameIsIgnoredSoWhyBother?"
  12.     Math::Script 'SaR(s,fa,ra, i,f,r,e,p) (i=0;#{i<l(fa),e=l(f=fa[i]);r=ra[i];p=0;#{p<l(s),#[s[p,p+e-1]==f,s=(s[,p-1])+r+(s[p+e,]);p+=l(r), p++]}; i++}; s);'
  13.     Math::Script "TQ(s) (s = s(NS); #[s[0]=='$\"',s=s[1,]]; #[s[-1]=='$\"',s=s[,-2]]; NS = s)"
  14.     Math::Script "P(s,e, p,i) (p=-1;i=0; #{(i<l(s))&&(p<0), #[s[i,i+l(e)-1]==e, p=i]; i++}; p)"
  15.     Math::Script "DL(s) (s=s(NS); p=P(s,'\r\n'); #[p>=0, (NS=s[p+4,]; NS=#[p>0,s[,p-1],'']), (NS='';NS=s)])"
  16.  
  17.     Math::Script "a = 'Hello \r\n World \r\n!!!'; a = SaR(a,{'\r','\n'},{'$\r','$\n'}); R0 = a"
  18.     Math::Script "NS = '$\"In quotes$\"'; TQ(); R1=NS; R3=P(s(R1),'qu')"
  19.     Math::Script "NS = 'No quotes'; TQ(); R2=NS"
  20.     Math::Script "NS='123\r\n456\r\n789'; DL(); R4=NS; DL(); R5=NS; DL(); R6=NS; R7=NS"
  21.  
  22.  
  23.     DetailPrint "'$R0'"
  24.     DetailPrint "'$R1'"
  25.     DetailPrint "'$R2'"
  26.     DetailPrint "'$R3'"
  27.     DetailPrint "'$R4'"
  28.     DetailPrint "'$R5'"
  29.     DetailPrint "'$R6'"
  30.     DetailPrint "'$R7'"
  31.  
  32.     ; last plugin call must not have /NOUNLOAD so NSIS will be able to delete the temporary DLL
  33.     SetPluginUnload manual
  34.     ; do nothing
  35.     Math::Script ""
  36. SectionEnd 
  37.  
  38. ; eof
  39.