mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Skylark: Witz support for vararg links #1123
git-svn-id: svn://ultimatepp.org/upp/trunk@9125 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1a5985e5a8
commit
801cce3ca6
4 changed files with 27 additions and 4 deletions
|
|
@ -40,6 +40,8 @@ int CountLinkArgs(const Vector<String>& part)
|
|||
int args = 0;
|
||||
for(int i = 0; i < part.GetCount(); i++) {
|
||||
int p = (byte)*part[i];
|
||||
if(p == 255) // it's a ** node, we can supply unlimited number of arguments
|
||||
return -1;
|
||||
if(p >= 0 && p < 30)
|
||||
args = max(args, p + 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,15 +138,17 @@ void RegisterView0(void (*fn)(Http&), Callback1<Http&> cb, const char *id, Strin
|
|||
if(IsDigit(s[1]))
|
||||
linkargpos = argpos = minmax(atoi(~s + 1), 0, 30);
|
||||
else
|
||||
if(s[1] == '*')
|
||||
if(s[1] == '*') {
|
||||
argpos = DISPATCH_VARARGS;
|
||||
linkargpos = 255;
|
||||
}
|
||||
q = DispatchMap.GetCount();
|
||||
LLOG(" Adding arg " << argpos << ": " << q);
|
||||
n.subnode.Add(Null, q);
|
||||
DispatchMap.Add();
|
||||
DispatchMap[q].argpos = argpos;
|
||||
if(primary)
|
||||
linkpart.Add(String(linkargpos++, 1));
|
||||
linkpart.Add(String(min(linkargpos++,255), 1));
|
||||
}
|
||||
else {
|
||||
if(primary)
|
||||
|
|
|
|||
|
|
@ -326,6 +326,12 @@ void MakeLink(StringBuffer& out, const Vector<String>& part, const Vector<Value>
|
|||
{
|
||||
LTIMING("MakeLink");
|
||||
out.Cat("/");
|
||||
Bits usedArgs;
|
||||
for(int i = 0; i < part.GetCount(); i++) {
|
||||
int q = (byte)*part[i];
|
||||
if(q < 32)
|
||||
usedArgs.Set(q);
|
||||
}
|
||||
for(int i = 0; i < part.GetCount(); i++) {
|
||||
const String& p = part[i];
|
||||
if(i)
|
||||
|
|
@ -335,6 +341,19 @@ void MakeLink(StringBuffer& out, const Vector<String>& part, const Vector<Value>
|
|||
if(q >= 0 && q < arg.GetCount())
|
||||
sUrlEncode(out, AsString(arg[q]));
|
||||
}
|
||||
else
|
||||
if(q == 255) {
|
||||
bool first = true;
|
||||
for(int j=0; j<arg.GetCount(); ++j) {
|
||||
if (usedArgs.Get(j))
|
||||
continue;
|
||||
if(!first) {
|
||||
out << '/';
|
||||
}
|
||||
first = false;
|
||||
sUrlEncode(out, AsString(arg[j]));
|
||||
}
|
||||
}
|
||||
else
|
||||
sUrlEncode(out, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef _Skylark_icpp_init_stub
|
||||
#define _Skylark_icpp_init_stub
|
||||
#include "Sql/init"
|
||||
#define BLITZ_INDEX__ F99b1b565e5194ee2f9bb1998be2e6f71
|
||||
#define BLITZ_INDEX__ Ffdceedd0c779faf45203de4d20cc5340
|
||||
#include "StdLib.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#define BLITZ_INDEX__ Fadc563b9c69ab7173de2094508da8708
|
||||
#define BLITZ_INDEX__ Fe14c3b567600743c08c9ce0e5cca713c
|
||||
#include "Static.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue