Re: [offtop] ctpp 2.8 __key__ __size__

vladsm at mail.ru
Thu Apr 4 15:12:45 UTC 2013


   :

__size__  , ..   --   CHANGES

__key__     . 

..   EMPLOYEE_INFO  ,  :
{
'EMPLOYEE_INFO': {
       'a': { 'NAME': " ", 'JOB': "" },
       'b': { 'NAME': " ", 'JOB': "" },
       'c': { 'NAME': " ", 'JOB': "" },
       'd': { 'NAME': " ", 'JOB': "" }
    }
}

.....
if (oRegs[iSrcReg].GetType() == CDT::HASH_VAL)
{
 CDT::Iterator it = oRegs[iSrcReg].Begin();
 for (INT_32 iI = 0; iI < iIdx; ++iI) { ++it; }
 oItVal["__value__"] = it->second;
 oItVal["__key__"] = it->first;
 oRegs[iDstReg >> 8] = oItVal;
}
else
{
 oItVal["__value__"] = oRegs[iSrcReg][iIdx];
 oItVal["__index__"] = iIdx;
 oRegs[iDstReg >> 8] = oItVal;
}
...

,  4  2013, 18:32 +04:00   <public-mail at alekciy.ru>:
>   ,     
> ctpp 2.8      
>__key__  __size__?   ,     
> __size__   .
>
>_____________________
>:
> json :
>[root at mail testdata]# cat items.json
>{
>'EMPLOYEE_INFO': [
>{ 'NAME': " ",   'JOB': "" },
>{ 'NAME': " ",   'JOB': "" },
>{ 'NAME': " ", 'JOB': "" },
>{ 'NAME': " ",    'JOB': "" }
>]
>}
>
>
> :
>[root at mail testdata]# cat items.tmpl
><table width="100%">
><TMPL_foreach EMPLOYEE_INFO as  EMPLOYEE>
><tr>
><td>#:
>first=<TMPL_var EMPLOYEE.__first__>,
>last=<TMPL_var EMPLOYEE.__last__>,
>index=<TMPL_var EMPLOYEE.__index__>,
>key=<TMPL_var EMPLOYEE.__key__>,
>inner=<TMPL_var EMPLOYEE.__inner__>,
>odd=<TMPL_var EMPLOYEE.__odd__>,
>even=<TMPL_var EMPLOYEE.__even__>,
>size=<TMPL_var EMPLOYEE.__size__>
></td>
><td>: <TMPL_VAR NAME></td>
><td>: <TMPL_VAR JOB></td>
></tr>
></TMPL_foreach>
></table>
>
>
>:
>[root at mail testdata]# /opt/ctpp2/2.8.2/bin/ctpp2c items.tmpl items.ct2
>[root at mail testdata]# /opt/ctpp2/2.8.2/bin/ctpp2vm items.ct2 items.json
>WARNING: [limit of steps] not set, use default value of 10240
><table width="100%">
>
><tr>
><td>#:
>first=1,
>last=,
>index=0,
>key=,
>inner=,
>odd=1,
>even=,
>size=
></td>
><td>:  </td>
><td>: </td>
></tr>
>...
>_______________________________________________
>nginx-ru mailing list
>nginx-ru at nginx.org
>http://mailman.nginx.org/mailman/listinfo/nginx-ru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-ru/attachments/20130404/0a4b35ed/attachment-0001.html>


nginx-ru