Annotation of parser3/www/htdocs/index.html, revision 1.194
1.104 paf 1: @USE
1.105 paf 2: /derived.p
1.145 paf 3: /operators.p
1.15 paf 4:
1.72 paf 5: @auto[filespec]
6: $selffilespec[$filespec]
1.63 paf 7: #$form:here
1.131 paf 8: #$request:charset[UTF-8]
1.177 paf 9: $request:charset[windows-1251]
10: $response:charset[windows-1251]
1.112 paf 11: #$response:charset[UTF-8]
1.131 paf 12: #$response:charset[empty]
1.84 paf 13: #$response:content-type[$.value[text/html]$.charset[$response:charset]]
1.15 paf 14:
1.171 paf 15: @postprocess[body]
1.60 paf 16: #<b>$body</b>
17: #$result[123]
1.171 paf 18: $body
19: <hr>
20: OK
1.37 paf 21:
1.15 paf 22: @main[]
1.72 paf 23: #$a(123)
24: #^a.format[%.10u]
1.71 paf 25: #$result[111]
1.70 paf 26: #^f[a]
1.133 paf 27: #^connect[mysql://mdm:4b833ljq@db-mysql/mdm]{
1.88 paf 28: # ^int:sql{select news_id from news where news_id=-1}[
1.143 paf 29: # $.default{2}
1.88 paf 30: # ]<br>
1.115 paf 31: # ^hash::sql{bad}
1.88 paf 32: # ^string:sql{select news_id from news where news_id=-1}[$.default{2}]
1.109 paf 33: # ^file::load[text;^string:sql{select 'from sql server' }]
1.95 paf 34: # ^string:sql{select '^^hello[]' }] $ORIGINS(1)
1.96 paf 35: # ^process{ ^^h[]}
1.97 paf 36: # ^process{^string:sql{select '1
37: # ^^hello[]' }] }
1.131 paf 38: # ^double:sql{select '2*' ^; }
1.133 paf 39: #$card_sequence_expect_no(^double:sql{select 20020909131047 #card_sequence_expect_no from card_sequence})
40: #^card_sequence_expect_no.format[%15.f]
41: #}
1.49 paf 42: #^eval(2)
1.48 paf 43: #^tcrashlocaljunctionsv2[]
1.49 paf 44: #^tcrashlocaljunctions[]
1.50 paf 45: #^tjunctions[]
1.47 paf 46: #^replacetest[]
1.48 paf 47: #^matchoptionpp[]
1.46 paf 48: #^txdocxnodechild[]
1.44 paf 49: #^tclasses[]
1.43 paf 50: #$math:PI
51: #^b:method[]
1.42 paf 52: #^main[]
1.41 paf 53: #^errort[]
1.44 paf 54: #^tselectNumber[]
1.39 paf 55: #$result[hello]
1.36 paf 56: #^invaliddate2[]
57: #^process2[]
58: #^casehashtext[]
1.35 paf 59: #^subjvaltest[]
60: #^tableselect0[]
1.34 paf 61: #^memnotest1[]
1.32 paf 62: #^voidparams[]
1.31 paf 63: #^rolls2[]
1.30 paf 64: #^cacheexpireschanging[]
1.29 paf 65: #^cacheexpiresfixed[]
66: #^dateoffsets[]
67: #^exceptionTypes[]
1.28 paf 68: #^roll2[]
1.27 paf 69: #^rolls[]
1.25 paf 70: #^exceptions1[]
1.22 paf 71: #^locate_by_expr[]
1.18 paf 72: #^method_junction_params{...}
1.17 paf 73: #^verifyCookie[paf]
1.37 paf 74: #^execlangs[]
1.16 paf 75: #$t[^tobjeresult[]]$t.a
76: #^xmlprobs[]
1.15 paf 77: #^doubleprobs[]
78: #^math:random(-10)
79: #^divnamestop[]
80: #^arrayclone[]
81: #^operator_tricks[]
82: #^xoutputrusattr[]
83: #^xdocset1[]
84: #^regexp3[]
85: #^exec2[]
86: #^tlock[]
87: #^xmloutattrwithoutvalue[]
88: #^precisionProblem[]
89: #^xpath[]
90: #^ttablesetlang[]
91: #^ttime[]
92: #^tupper[]
93: #^treplace[]
94: #^xslt2[]
95: #^tcache2[]
96: #$ORIGINS(1)
97: #$t[^table::set{a b} ^table::set{c d}]
98: #^ttaintuntaint[]
99: #^tappend2[]
100: #^badvsnprintf[]
101: #^badoracequoting[]
102: #^badconstructors[]
103: #^xloadwrongtable[]
104: #^xsetwrongtable[]
105: #^if($form:test){y}{n}
106: #^tablecolumnerror[]
107: #^roll[]
108: #^tableset[]
109: #^math:PI.format{%.30f}
110: #^xchildren[]
111: #^thashforeach3[]
112: #^thashforeach2[]
113: #^thashforeach[]
114: #^thashdelete[]
115: #^connect[mysql://user:pass@cd.rinet.ru/db]{^void:sql{z} }
116: #^tappend[]
117: #^sappend[]
118: #^eval(10\3)<br>
119: #^tform[]
120: #^formattest[]
121: #^filelist[]
122: #^connect[mysql://user:pass@host]{ }
123: #^безнадёжна_попытка_поправить_непоправимое[]
124: #^tcache[]
125: #^thashfileexp[]
126: #^tcounter[]
127: #^tablehash[]
128: #j^hashfile[]
129: #^formclass[]
130: #^hren[]
131: #^domedit[]
132: #^domxslt[]
133: #^lsplit2[]
134: #^faceesize[]
135: #^imageresize[]
136: #^ifassignhash[]
137: #^tintdefault[]
138: #$response:status[404]
139: #^ifpasshash[]
140: #^movedir[]
141: #^replace[]
142: #^set[]
143: #^hash[]<hr>
144: #$t[^methresult[]] ->$t
145: #^terror[]
146: #^ssave[]
147: #^thash[]
148: #^tdef[]
149: #^ford[]
150: #^tif[]
1.84 paf 151: #^image[]
1.15 paf 152: #^response[]
153: #^regexp2[]
154: #^ttablerem[]
155: #^pcre[]
156: #^regexp[]<hr>
157: #^mail[]
158: #^fori[]
159: #^tconnect[]
160: #^xslt[]
161: #^header[]
1.53 paf 162: #^tablehasht[]
1.54 paf 163: #^datecreatestring[]
1.56 paf 164: #^mssqltypes1[]
165: #^badthrows[]
1.57 paf 166: #^xmlspace[]
167: #^counter[main.counter]
168: #^xpath2[]
169: #^callindirect[]
170: #^junctionprob[]
1.59 paf 171: #^datecreatestring2[]
172: #^tstoredproc[]
173: #^tstoredproc2[]
174: #^forkeys[]
1.60 paf 175: #^pngsize[]
1.61 paf 176: #^checkList[]
1.63 paf 177: #^datetest[]
1.65 paf 178: #^tserge[]
1.69 paf 179: #^envt[]
1.67 paf 180: #^selectt[]
181: #^select2[]
182: #^selectSingle2[]
183: #^selectString2[]
184: #^selectNumber2[]
185: #^selectBool2[]
186: #^xdoccreate[]
187: #^xdoccreatetag[]
1.70 paf 188: #^xdocload[]
1.67 paf 189: #^xdocstring[]
190: #^xdocsave[]
1.68 paf 191: #^div[]
192: #^datecreatestring3[]
1.73 paf 193: #^tfilespec[]
1.77 paf 194: #^tcrypt[]
1.74 paf 195: #^cryptdocsample[]
1.78 paf 196: #^tnormalize[]
1.83 paf 197: #^xmltransformbyxdoc[]
1.81 paf 198: #^sergestrandef[]
1.83 paf 199: #^tstdin[]
200: #^tfind[]
1.86 paf 201: #^mimet[]
1.92 paf 202: #^joinlimit[]
1.89 paf 203: #^tableclonelimit[]
1.91 paf 204: #^transparams[]
205: #^sendtests[]
1.93 paf 206: #^wwrapperpass[]
1.95 paf 207: #^badpos[]
1.98 paf 208: #^processtest[]
209: #^mail3[]
1.100 paf 210: #^datesaving[]
1.101 paf 211: #^badconstructor[]
1.103 paf 212: #^calendar[]
1.104 paf 213: #^monthdays(8)
214: #^xdoctypetest[]
1.105 paf 215: #^xtabletest[]
1.117 paf 216: #^staticstest[]
1.108 paf 217: #^staticstest2[]
1.115 paf 218: #^rbodytest[]
219: #^cookie[]
1.116 paf 220: #^cookieexpirestest[]
1.119 paf 221: #^postest[]
1.120 paf 222: #^voidpostest[]
1.122 paf 223: #^badcolumntest[]
1.124 paf 224: #^delimiters[]
1.125 paf 225: #^новый-split[]
1.127 paf 226: #^грязные-cookie[]
227: #^html-почта[]
228: #^badswitchtest[]
1.128 paf 229: #^okswitchtest[]
1.131 paf 230: #^cgit[]
1.132 paf 231: #^ttransformsep[]
1.133 paf 232: #^calltest[]
1.134 paf 233: #^xpath3[]
1.139 paf 234: #^doubleliterals[]
235: #^newxor[]
1.135 paf 236: #^mail2[]
1.139 paf 237: #^exec[]
1.140 paf 238: #^passpost[]
1.141 paf 239: #^fordelim[]
1.143 paf 240: #^duplicatetable2hashkey[]
1.142 paf 241: #^duplicatehashsqlkey[]
1.145 paf 242: #^longlreplace[]
243: #^table2hash_onecolumn[]
1.146 paf 244: #^crossopvars[]
1.148 paf 245: #^three[]
1.149 paf 246: #^badLangAfterCatch[]
1.150 paf 247: #^zeroinstdin[]
1.151 paf 248: #^shifts[]
249: #^jspace[]
1.152 paf 250: #^hashselfmodification[]
251: #^emptyTransformResult[]
252: #^badxdoccreate[]
1.154 paf 253: #^if(-d "CVS"){y}{n}
1.155 paf 254: #^badjunctioncall[]
1.156 paf 255: #^russianindex[]
256: #^virtualtest[]
257: #^xml[]
258: #^mail4[]
1.157 paf 259: #^voidconstructorpass[]
1.160 paf 260: #^$form:CLASS.a=$form:CLASS.a<br>
261: #^cookie2[]
262: #^menudelim[]
1.158 paf 263: #^touchittest[]
1.162 paf 264: #^touchittest2[]
1.160 paf 265: #^opauto[]
1.161 paf 266: #^trycontextt[]
267: #^tfor[]
1.162 paf 268: #^user-foreach-test[]
269: #^includet[]
1.163 paf 270: #^derived:includet[]
1.164 paf 271: #^fortestsep[]
1.165 paf 272: #^derived:inclass_process_test[]
273: #$derived[^derived::create[]]^derived.inclass_process_test[]
1.166 paf 274: #^domorigint[]
1.167 paf 275: #^junctiontest2[]
1.169 paf 276: #^junctionselftest[]
1.170 paf 277: #^bad-compiletosystem[]
278: #^steppedfor[i](1;10;2){$i }
1.171 paf 279: #^file:fullpath[a.gif]<br>
280: #^file:fullpath[/abs/a.gif]<br>
281: #$form:a/$form:image-map=
282: #^foreachform[]
283: #^selectSingleoct[]
284: #^compilebug[]
285: #^badhashcreate[]
1.172 paf 286: #^badsendmail[]
287: #^keygenedhash[]<br>
288: #<hr>[$env:HTTP_REFERER]
289: #$response:Content-TypE[bad]
1.174 paf 290: #^emailhead2[]
1.175 paf 291: #^includet2overridedynamic[]
1.176 paf 292: #^includet2overridestatic[]
1.177 paf 293: #^virtualtest2[]
294: #^message-id-test[]
1.194 ! paf 295: #^test_exif[jpg]
1.183 paf 296: #^http_prefix[]
1.179 paf 297: #^http_prefix_table[]
1.193 paf 298: #^http_prefix_xml[]
1.189 paf 299: #^imagefont[]
1.185 paf 300: #^downloadtest[]
1.186 paf 301: #^cachebug[]
1.188 paf 302: #^quickregexatend[]
1.189 paf 303: #^docsamplehttpfileload[]
1.193 paf 304: #^datecreatecolon[]
1.194 ! paf 305: ^exifdocsample[]
! 306:
! 307: @exifdocsample[]
! 308: $image[^image::measure[jpg/DSC00003.JPG]]
! 309: $exif[$image.exif]
! 310: ^if($exif){
! 311: Производитель фотоаппарата, модель: $exif.Make $exif.Model<br>
! 312: Время съемки: ^exif.DateTimeOriginal.sql-string[]<br>
! 313: Выдержка: $exif.ExposureTime секунды<br>
! 314: Диафрагма: F$exif.FNumber<br>
! 315: Использовалась вспышка: ^if(def $exif.Flash){^if($exif.Flash){да;нет};неизвестно}<br>
! 316: }{
! 317: нет EXIF информации<br>
! 318: }
! 319:
! 320: @exif_value[value][i]
! 321: ^if($value is date){
! 322: ^value.sql-string[]
! 323: }{
! 324: ^if($value is hash){
! 325: ^for[i](0;$value-1){$value.$i}[,]
! 326: }{
! 327: $value
! 328: }
! 329: }
! 330:
! 331:
! 332:
1.193 paf 333:
334: @datecreatecolon[]
335: #$date[^date::create[2002-12-02 14:30]]
336: #$date[^date::create[2002-12-02]]
337: #$date[^date::create[2002:12:02 13:30]]
338: $date[^date::create[2002:12:02]]
339: #$date[^date::create[12:02]]
340: ^date.sql-string[]
1.189 paf 341:
342: @docsamplehttpfileload[]
343: $file[^file::load[text;http://parser.ru/]]
344: Программное обеспечение сервера: $file.SERVER
345: <hr>
346: <pre>$file.text</pre>
1.187 paf 347:
348: @quickregexatend[]
349: #$subject[xxxabcd]
350: #^if(^subject.match[^(?>.*)(?<=abcd)]){y;n}
351: $subject[^for[i](0;1000){xxxxxyyyyy} ]
352: ^for[j](0;1000){
353: #$trimmed[^subject.match[\s+^$][]{}]
354: #$table[^subject.match[^(.*\S)\s+^$]]
355: $table[^subject.match[^(.*\S)\s+^$]]
356: $trimmed[$table.1]
357: }
358: ^untaint[html]{"$trimmed"}
359: #$table[^subject.match[^(.*?)\s+^$]]
360: #^untaint[html]{"$table.1"}
361:
1.185 paf 362:
363: @cachebug[]
364: ^cache[test](10){body}
1.184 paf 365:
366: @downloadtest[]
367: $response:body[^file::load[binary;index.html]]
368:
1.183 paf 369:
370: @imagefont[]
1.186 paf 371: $image[^image::create(200;30;0x00FFFF)]
1.183 paf 372: height(font)=1950<br>
373: $alph[ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя0123456789-+=!\"%:,.^;<>?@()^[^]'&*/]
374: ^^alph.length[]=^alph.length[]<br>
375: ^eval(1950/^alph.length[])[%.10f]
376:
1.184 paf 377: ^image.font[$alph;font.gif](20)
1.188 paf 378: $text[AПривет*]
379: ^image.text(0;0)[$text]
380: $length[^image.length[$text]]
381: #^image.rectangle(0;50)(2;2)(0x000000)
382: ^image.rectangle(0;0)($length-1;5)(0x000000)
1.183 paf 383: $response:body[^image.gif[]]
1.179 paf 384:
385: @http_prefix_xml[]
1.191 paf 386: $xdoc[^xdoc::load[http://www.cbr.ru/scripts/XML_daily.asp?^taint[сегодня];
387: $.headers[
388: $.user-agent[ПАФ]
1.192 paf 389: $.accept-test[$.value[значение]$.with-option[опция]]
1.191 paf 390: ]
391: ]]
1.189 paf 392: На ^xdoc.selectString[string(/ValCurs/@Date)]
393: курс валюты
394: $USD_node[^xdoc.selectSingle[/ValCurs/Valute[CharCode='USD']]]
395: "^USD_node.selectString[string(Name)]" равен ^USD_node.selectString[string(Value)]
1.181 paf 396:
1.189 paf 397: <hr>
1.179 paf 398: <pre>^taint[^xdoc.string[]]</pre>
399:
400: @http_prefix_table[]
401: $table[^table::load[nameless;http://www.artlebedev.ru;$.USER-AGENT[paf]]]
402: ^table.count[]
403: <hr>
404: <pre>$table.0</pre>
405:
406: @http_prefix[]
407: #$file[^file::load[text;http://www.artlebedev.ru]]
408: #$file[^file::load[text;http://www.artlebedev.ru;alt]]
1.182 paf 409: #$file[^file::load[text;http://parser3/exif.html;
1.180 paf 410: $file[^file::load[text;http://parser3/none;
411: $.headers[
412: $.USER-AGENT[paf]
413: ]
1.179 paf 414: ]]
1.181 paf 415: server: $file.SERVER<br>
1.179 paf 416: $file.status
417: <hr>
418: <pre>$file.text</pre>
1.177 paf 419:
1.178 paf 420: @test_exif[dir]
421: $file[^file:list[$dir;\.(jpe?g|JPE?G)^$]]
422: <table border=1>
1.177 paf 423: ^file.menu{
1.178 paf 424: <tr valign=top>
1.177 paf 425: $image[^image::measure[$dir/$file.name]]
1.178 paf 426: <td>^image.html[$.width(100)$.height(100)]</td>
427: <td>
428: $file.name<hr>
429: $exif[$image.exif]
430: ^if($exif){
431: $keys[^exif._keys[]] ^keys.sort{$keys.key}
432: ^keys.menu{
433: $key[$keys.key]
434: $value[$exif.$key]
435:
436: ${key}: <b>^show_exif_value[$value]</b><br>
437: }
438: }{
439: no EXIF info<br>
440: }
441: </td>
442: </tr>
443: }
444: </table>
445:
446: @show_exif_value[value][i]
1.193 paf 447: ^if($value is date){
448: ^value.sql-string[]
1.178 paf 449: }{
1.193 paf 450: ^if($value is hash){
451: ^for[i](0;$value-1){$value.$i}[,]
452: }{
453: $value
454: }
1.177 paf 455: }
456:
457: @message-id-test[]
458: ^mail:send[
459: $.from[paf@mail]
460: $.to[paf@mail]
461: $.subject[test]
462: # $.message-id[<1@parser.ru>]
463: $.Message-id[<2@parser.ru>]
464: $.subject[проверка]
465: $.text[мычит!]
466: ]
1.176 paf 467:
468: @virtualtest2[]
469: $derived[^derived::create[]]
470: ^derived.first[]
471:
1.174 paf 472:
1.175 paf 473: @includet2overridedynamic[]
1.176 paf 474: includet2overridedynamic:<br>
475: shold say 'hello in some.p'<br>
476: <hr>
1.174 paf 477: $derived[^derived::create[]]
478: ^derived.includet2override[]
1.175 paf 479:
480: @includet2overridestatic[]
1.176 paf 481: includet2overridestatic:<br>
482: shold say 'hello in derived.p'<br>
483: because in static classes there's no way to determine derived class (no virtual mech becase of no virtual table)<br>
484: <hr>
1.175 paf 485: ^derived:includet2override[]
1.172 paf 486:
487: @emailhead2[]
488: ^mail:send[
489: $.charset[koi8-r]
490: $.from[paf@design.ru]
491: $.to[paf@mail]
1.174 paf 492: # $.reply-to[^taint[agat] <^taint[ag_7k@mail.ru]>]
493: $user[^taint[agat]]
494: $email[^taint[ag_7k@mail.ru]]
495: $.reply-to[$user $email]
496: $.subject[test2]
1.172 paf 497: ]
498:
499: @keygenedhash[]
500: $table[^table::create{key value
501: 1 a
502: 2 b
503: }]
504: $hash[^table.hash($table.key*2)]
505: '$hash.4.value' must be 'b'
1.171 paf 506:
507: @badsendmail[]
508: ^mail:send[
509: $.from[hren < paf@design.ru
510: >]
511: $.to[paf@design.ru]
512: $.subject[test]
513: ]
514:
515: @badhashcreate[]
516: $hash[
517: $.ok[1]
518: ]
519: $.bad[1]
520:
521: @compilebug[]
522: ^a[]^#31=
523:
524: @selectSingleoct[]
525: $d[^xdoc::create[doc]]
526: $element[^d.selectSingle[$nothing]]
527:
528:
529: @foreachform[]
530: <a href=index.cgihtml?one&a=1&two&b=2&three?1,2>one</a><br>
531: <a href=index.cgihtml?one&a=1&two&b=2&three?shit>two</a><br>
532:
533: ^form:fields.foreach[key;value]{
534: $key -- $value
535: }[<br>]
536: <hr>
537: $nameless[$form:tables.nameless]
538: ^if(def $nameless){
539: nameless table -- ^nameless.menu{$nameless.field}[,]
540: }
541: ^if(def $form:imap){
542: <hr>
543: IMAP $form:imap.x : $form:imap.y
544: }
1.170 paf 545:
546: @steppedfor[name;from;to;step;code]
547: $caller.$name($from)
548: ^while($caller.$name<=$to){
549: $code
550: ^caller.$name.inc($step)
551: }
1.169 paf 552:
553: @bad-compiletosystem[]
554: ^process[$string:CLASS]{@a[]
555: }
1.168 paf 556:
557: @junctionselftest[]
558: $derived[^derived::create[]]^derived.explodejunction{$tomain[tomainOK]}
559: ^$tomain=$tomain
1.166 paf 560:
561: @junctiontest2[]
562: ^if($if is junction){is junction;not junction}<br>
563: ^if(def $if){defined;not defined}<br>
1.165 paf 564:
565: @domorigint[]
566: $xdoc[^xdoc::create[вася]]
567: ^xdoc.firstChild.setAttribute[name;значение]
568: $var[$xdoc.firstChild.nodeName]
569: ^throw[paf;$var]
570:
1.163 paf 571:
572: @fortestsep[][i]
573: ^for[i](1;3){$i}[,]
1.162 paf 574:
575: @includet[]
576: ^include[some.p]
577: ^included_method[2]
578:
579: @user-foreach-test[][key;value]
580: ^user-foreach[key;value]{$key=$value<br>}
581:
582: @user-foreach[key;value;code]
583: ^for[i](1;10){
584: $caller.$key($i)
585: $caller.$value($i*2)
586: $code
587: }
588:
1.161 paf 589:
590: @tfor[][i]
591: ^for[i](1;10){
592: $i
593: }
1.160 paf 594:
595: @trycontextt[]
596: ^try{
597: ^trycontexttsub[]
598: }{
599: $exception.handled(0)
600: }
601:
602:
603: @trycontexttsub[]
604: ^bad[]
605:
606:
607: @opauto[]
608: ^reada[]
1.159 paf 609:
610:
1.157 paf 611: @rusage2[]
1.77 paf 612: <hr>
1.74 paf 613: OK
1.157 paf 614:
615: @rusage2[]
616: $s[$status:rusage]
617:
618: ^s.tv_sec.format[%.0f].^s.tv_usec.format[%06.0f]
619:
1.150 paf 620:
1.156 paf 621: @voidconstructorpass[]
622: $a[$form:a]
623: =^form:a.int(1)=
624: =^a.int(1)=
625:
626:
1.155 paf 627: @russianindex[]
628: #dir with files with russian-lang names
629: $where[dir]
630:
631: $dir[^file:list[$where;\.txt^$]]
632: ^dir.menu{
633: <a href=$where/^untaint[uri]{$dir.name}>$dir.name</a><br>
634: }
635:
1.154 paf 636: @badjunctioncall[]
637: ^badjunctioncallinside{code}
638:
639: @badjunctioncallinside[code]
1.155 paf 640: xx^code[]
1.152 paf 641:
642: @badxdoccreate[]
643: $xdoc[^xdoc::create[вася]]
644: #$xdoc[^xdoc::create{<?xml version="1.0" encoding="$request:charset"?><doc>вася</doc>}]
645:
646: ^xdoc.firstChild.setAttribute[name;значение]
647: ^xdoc.string[]
648:
649:
650: @emptyTransformResult[]
651: $input[^xdoc::create[docBad]]
652: $sheet[^xdoc::create{<?xml version="1.0"?>
653: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
654: <xsl:template match="doc">
655: output
656: </xsl:template>
657: </xsl:stylesheet>
658: }]
659: $output[^input.transform[$sheet]]
660: $response:body[^output.file[]]
661:
662: @hashselfmodification[]
663: $hash[
664: $.a[1]
665: $.b[2]
666: ]
667: ^hash.foreach[key;value]{
668: # $hash.c[1]
669: $hash.a[1]
670: }
671:
672: @touchittest[][i]
1.160 paf 673: $i[before]
674: ^touchit[]
675: $i
676:
677: @touchittest2[]
1.158 paf 678: $i[before]
1.152 paf 679: ^touchit[]
680: $i
681:
1.151 paf 682:
683: @jspace[]
684: $a(1)
685: ^jspace_call{^eval($a*2)}
686: #$a(2)
687: #$junction
688:
689: @jspace_call[param][a]
690: $a[unrelcfgdfgated]
691: $junction<br>
692: $junction.a(2)
693: $junction<br>
694:
1.150 paf 695: @shifts[]
696: ^eval(1<<3)<br>
697: ^eval(8>>2)<br>
1.151 paf 698: #^if(1=1){y;n}<br>
1.150 paf 699:
1.149 paf 700:
701: @zeroinstdin[]
702: #$f[^file::exec[a.pl;$.stdin[$.shit[]]]]
703: $f[^file::exec[a.pl;$.stdin[^file::load[binary;1z2.txt]]]]
704: =$f.text=
705: ^f.save[binary;1z2.out]
1.148 paf 706:
707: @badLangAfterCatch[]
708: ^try{
709: $a[
710: тут язык сменился на pass_appended
711: ^throw[user;test]
712: и улетело с не тем языком
713: ]
714: }{
715: $exception.handled(1)
716: }
717: 1 2
1.145 paf 718:
719: @crossopvars[]
720: #^one[]<hr>
721: ^two[]<hr>
722:
723: @table2hash_onecolumn[]
724: $t[^table::create{a
725: 1
726: 1
727: }]
728: #^t.hash[a]
729: #^t.hash[a;b]
730: $h[^t.hash[a][$.distinct(1)]]
731: $h.1.a
1.143 paf 732:
733: @longlreplace[]
1.144 paf 734: $str1[ мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла ]
1.143 paf 735: $str2[ела]
736: $str[Мама $str1 раму]
737:
1.144 paf 738: ^str.replace[^table::create[nameless]{мыла $str2}]
1.141 paf 739:
740: @duplicatehashsqlkey[]
741: ^connect[mysql://mdm:4b833ljq@db-mysql/mdm]{
742: $t[^table::sql{select * from news}]
743: $c[^t.columns[]]
744: ^c.menu{$c.column}[,]
745:
1.142 paf 746: $h[^hash::sql{select news_type_id, name from news}[$.distinct(1)]]
1.141 paf 747: }
748:
749: @duplicatetable2hashkey[]
750: $t[^table::create{a b
751: 1 2
752: 1 3
753: }]
1.142 paf 754: #^t.hash[a]
755: #^t.hash[a;b]
756: ^t.hash[a][$.distinct[1]]
1.140 paf 757:
758: @menudelim[]
759: $t[^table::create{a
760: 1
761: 2
762: 3
763: 4
764: 5
765: }]
766:
767: ^t.menu{^if($t.a<3){}{$t.a}}[,]
768:
769: @fordelim[]
770: ^for[a](0;6){^if($a<3){}{$a}}[,]
771:
1.135 paf 772:
1.139 paf 773: @passpost[]
774: <form method=post name="test" id="test">
775: <textarea name="text" cols=20 rows =6>^taint[html][1
776: 2
777:
778: 3]</textarea><br>
779: <input type=submit>
780: </form>
781:
782: ^if(def $form:text){
783: $a[^file::cgi[a.pl]]
784: $a.text|$a.status|$a.stderr<hr>
785: }
786:
787: @exec[]
788: #$a[^file::exec[a.cmd]]
789: $a[^file::cgi[a.cmd]]
790: $a.text|$a.status|$a.stderr<hr>
791:
792:
1.137 paf 793: @newxor[]
1.138 paf 794: ^eval(1!|2 #примечание()zzz
795: |0x100)<br>
1.137 paf 796: #^eval(1!||2)<br>
797: ^if(1!|1){y}{n}
798:
799: #@method[$bad]
1.136 paf 800:
1.135 paf 801: @doubleliterals[]
802: #^eval(1e-10)
803: ^eval("1e-20")
1.133 paf 804:
805: @xpath3[]
806: $constr[^xdoc::create{<?xml version="1.0" encoding="$request:charset" standalone="no"?> <constructor-data><object object_type_id="1" template_id="1" data_process_id="1" is_published="1">проверка</object> <block-list> <block name="date" type="0" label="Дата" is_hide_pub="1" data_type="1"/> <block name="content" type="0" label="Текст" is_hide_pub="1" data_type=""/> </block-list></constructor-data>}]
807: $objectData[^constr.selectSingle[/constructor-data/object]]
808: $objectData.nodeType<br>
809: $objectData.firstChild.nodeValue
810:
811: @calltest[]
812: ^calltest2[string]
813:
814: @calltest2[s]
815: $s
1.131 paf 816:
817: @ttransformsep[]
818: $input[^xdoc::load[20020909131046.xml]]
819: $output[^input.transform[generated.xsl]]
820: ^output.string[]
1.127 paf 821:
822: @okswitchtest[]
823: $local[local value]
824: ^switch[1]{
825: ^case[1]{1code $local}
826: }
827:
828: @badswitchtest[]
829: ^switch[1]{
830: ^badswitchtestcase[]
831: }
832: @badswitchtestcase[][local]
833: $local[local value]
834: ^case[1]{1code $local}
835:
836: @badjunction[]
837: ^badj1[]
838: ^badj2[]
839:
840: @html-почта[]
841: $переменная[значение]
842: ^mail:send[
843: $.from[paf@mail]
844: $.to[paf@mail]
845: $.subject[htmltest1]
846: $.html{тест$переменная= !}
847: ]
848:
1.124 paf 849:
850: @грязные-cookie[]
1.126 paf 851: $cookie:a[&]
1.125 paf 852: $cookie:a
1.124 paf 853:
854: @новый-split[]
855: $abc[a.b.c]
856: #$table[^abc.split[.]]
857: #$table[^abc.split[.;l]]
858: #$table[^abc.split[.;v]]
859: $table[^abc.split[.;lv]]
860: ^table.menu{$table.piece}[,]
861: <hr>
862: #$table[^abc.split[.;h]]
863: $table[^abc.split[.;hr]]
864: $table.0,$table.1,$table.2<br>
1.123 paf 865:
866: @delimiters[]
867: $a#1[1]<br>
868: $a#1=<br>
869:
1.121 paf 870:
871: @badcolumntest[]
872: $table[^table::load[ext.cfg]]
873: $table.b
874:
1.120 paf 875:
876: @virtualtest[]
877: $derived[^derived::create[derived create actual param]]
878: ^derived.test[]
879:
1.119 paf 880:
881: @voidpostest[]
882: $s[]
883: ^s.pos[$nothing]
1.118 paf 884:
885: @postest[]
886: $s[$nothing]
887: ^s.pos[$nothing]
1.113 paf 888:
1.115 paf 889: @cookieexpirestest[]
890: #$cookie:exptest[1]
891: #$cookie:exptest[$.value[2] $.expires(+1)]
892: $response:xxxx[^date::now(+10)]
893: $response:yyy[$.value[^date::now(+20)]]
894: $response:yyy[$.value[vvv] $.aaaa[^date::now(+20)]]
895:
1.113 paf 896: @rbodytest[]
897: $request:body=
898: <form method=post>
899: <input type=submit name=paf value=123>
900: </form>
1.107 paf 901:
902: @staticstest2[]
903: ^$derived:derived_var=$derived:derived_var<br>
904: ^$derived:a=$derived:a<br>
1.108 paf 905: $derived:a[changed] ^$derived:a=$derived:a<br>
1.107 paf 906: $derived:derived_var[changed]
907: ^$derived:derived_var=$derived:derived_var<br>
908:
1.105 paf 909: @staticstest[]
910: $derived[^derived::create[]]
911: ^derived.test[]
1.110 paf 912: <hr>
1.106 paf 913: ^$derived.a=$derived.a<br>
914: ^$derived.x=$derived.x<br>
1.110 paf 915: <hr>
916: ^if($derived is derived){derived is derived}{error: derived is not derived}<br>
917: ^if($derived is table){derived is table}{error:derived is not table}<br>
1.111 paf 918: <hr>
919: ^^eval(^$derived)=^eval($derived)<br>
920: ^^if(^$derived)=^if($derived){y}{n}<br>
1.106 paf 921:
1.105 paf 922:
1.104 paf 923: @xdoctypetest[]
924: $xdoc[^xdoc::create[x]]
925: ^if($xdoc is xdoc){y}{n}
926:
927: @xtabletest[]
928: $xtableo[^xtable::create[]]
929: ^if($xtableo is table){y}{n}
1.105 paf 930: #^xtableo.columns[]
1.100 paf 931:
1.103 paf 932: @monthdays[month]
933: $from[^date::create(2000;$month;1)]
934: $to[^date::create($from)] ^to.roll[month](+1)
935: $result($to-$from)
936:
1.100 paf 937: @badconstructor[]
938: ^date::now[]
1.99 paf 939:
940: @datesaving[]
941: $now[^date::now[]]
942: $now.daylightsaving<br>
943: $now.yearday<br>
944: #
945: $date[^date::create(2002;1;3)]
946: $date.daylightsaving<br>
947: $date.yearday
1.97 paf 948:
1.98 paf 949: @mail4[]
950: ^mail:send[
951: $.from[paf@mail.design.ru]
952: $.to[paf@mail.design.ru]
1.156 paf 953: $.subject[^taint[uri][москва=E0_+ ]=2]
1.98 paf 954: $.text[^taint[uri][москва]=]
955: $.html{<a href=http://there.ru/?city=^taint[uri][Москва]>link</a>}
956: ]
1.97 paf 957: @processtest[]
958: $f[^file::load[text;piece.p]] ^process{$f.text}
959: $ORIGINS(1)
1.93 paf 960:
961:
962: @badpos[]
963: $s[123]
1.94 paf 964: ^s.mid(0;2)
1.92 paf 965:
966: @wwrapperpass[]
967: $h[^hash::create[]]
968: $h.a(1)
969: ^my_method[^if(1){$h}]
970: работает. так и должно быть?
971:
972: @my_method[p]
973: ^p._count[]
974:
1.88 paf 975:
976: @tableclonelimit[]
977: $source[^table::create{a
978: aa
979: bb
980: cc}]
981: ^source.offset(1)
982: #$dest[^table::create[$source]]
983: $dest[^table::create[$source;$.offset(2)]]
984: $dest[^table::create[$source;$.limit(2)]]
985: $dest[^table::create[$source;$.offset(1)$.limit(1)]]
986: $dest[^table::create[$source;$.offset(1)$.limit(2)]]
987: $dest[^table::create[$source;$.offset[cur]$.limit(2)]]
988:
989: ^dest.menu{$dest.a}[,]<br>
990:
991: @joinlimit[]
992: $source[^table::create{a
993: aa
994: bb
995: cc}]
996: ^source.offset(2)
997: $dest[^table::create{a
998: xx
999: }]
1000: #^dest.join[$source]
1001: #^dest.join[$source;$.offset(2)]
1002: #^dest.join[$source;$.limit(2)]
1003: #^dest.join[$source;$.offset(1)$.limit(1)]
1004: #^dest.join[$source;$.offset(1)$.limit(2)]
1.91 paf 1005: #^dest.join[$source;$.offset[cur]$.limit(1)]
1006: ^dest.join[$source;$.limit(0)]
1.88 paf 1007:
1008: ^dest.menu{$dest.a}[,]<br>
1.86 paf 1009:
1010: @cgit[]
1011: $f[^file::cgi[showenv.cmd]]
1012: $f.HELLO=<br>
1013: $f.CONTENT-TYPE=<br>
1014: $f.content-type=<br>
1015:
1.83 paf 1016:
1.84 paf 1017: @mimet[]
1.85 paf 1018: $f[^file::stat[a.GIF]]
1019: $f.content-type
1.84 paf 1020:
1021:
1.83 paf 1022: @tfind[]
1023: ^file:find[index.html]
1024:
1025: @tstdin[]
1026: $f[^file::exec[test.pl;$.stdin[проверка stdin потока]]]
1027: <pre>$f.text</pre>
1.80 paf 1028:
1029: @sergestrandef[]
1030: $sQuantity[ ]
1031: ^sQuantity.int(10)
1.78 paf 1032:
1033: @xmltransformbyxdoc[]
1034: $xdoc[^xdoc::set{^process{<?xml version="1.0" encoding="windows-1251"?>
1035: <!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
1036: <people>
1037: <man id="1" имя="word слово">
1038: <name>1 2</name>
1039: </man>
1040: </people>
1041: }}]
1042: $sheet[^xdoc::create{<?xml version="1.0"?>
1.79 paf 1043: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
1044:
1045: >
1.78 paf 1046: <!--<xsl:output doctype-public ="-//W3C//DTD XHTML" indent="yes"/>-->
1047:
1.79 paf 1048: <!--<xsl:import href="http://localhost/html.xsl"/>-->
1049: <xsl:import href="html.xsl"/>
1050:
1.78 paf 1051: <xsl:param name="param1">defparam1</xsl:param>
1052: <xsl:param name="param2">defparam2</xsl:param>
1.79 paf 1053:
1.78 paf 1054:
1055: <xsl:template match="doc">
1056: param1=<xsl:value-of select="^$param1"/><br/>
1057: param2=<xsl:value-of select="^$param2"/><br/>
1058:
1059: test return <something background=""/>
1060: </xsl:template>
1061:
1062: <xsl:template name="test">
1.81 paf 1063: test return3
1.78 paf 1064: </xsl:template>
1065:
1066: <xsl:template match="people">
1067: <html>
1.155 paf 1068: <head>
1069: <link type='text/xml' rel='alternate' href='/Default.vsdisco'/>
1070: z</head>
1.78 paf 1071: para1=<xsl:copy-of select="^$param1"/>
1072: <xsl:apply-templates/>
1073: <hr/>
1074: <xsl:call-template name="test"/>
1075: </html>
1076: </xsl:template>
1077:
1078: <xsl:template match="name">
1079: <b><xsl:value-of select="."/></b>
1080: </xsl:template>
1081: </xsl:stylesheet>
1082: }]
1083:
1084:
1085: $xdoc[^xdoc.transform[$sheet]]
1086: $string[^xdoc.string[$.method[html]]]
1087: ^string.save[a]
1088: ^untaint[html]{$string}
1089:
1090:
1.77 paf 1091:
1092: @tnormalize[]
1093: #s состоит из 1000 фрагментов
1094: $s[^for[i](0;999){фрагмент }]
1095: #это займет много ресурсов
1096: ^s.match[фраг][g]{перга}
1097: #это займет меньше ресурсов
1098: #$normalized[^s.normalize[]]
1099: #^normalized.match[фраг][g]{перга}
1.74 paf 1100:
1101: @sendtests[]
1.89 paf 1102: ^text[]
1.74 paf 1103: #^html[]
1104: #^text-n-html[]
1105: #^file[]
1106: #^text-n-file[]
1.89 paf 1107: #^text-n-html-n-file[]
1.74 paf 1108: #^backwardcomp[]
1109:
1110: @backwardcomp[]
1111: ^mail:send[
1112: $.from[paf]
1113: $.to[paf]
1114: $.body[this is text value]
1115: ]
1116:
1117: @text[]
1118: ^mail:send[
1119: $.from[paf]
1.90 paf 1120: $.to[paf]
1.74 paf 1121: $.text[
1122: $.value[this is text value]
1123: ]
1124: ]
1125:
1126: @html[]
1127: ^mail:send[
1128: $.from[paf]
1129: $.to[paf]
1130: $.html{this is <b>html</b> value ^taint[<] 10}
1131: ]
1132:
1133: @text-n-html[]
1134: ^mail:send[
1135: $.from[paf]
1136: $.to[paf]
1137: $.text[
1138: $.value[this is text value]
1139: ]
1140: $.html[
1141: $.value{this is <b>html</b> value ^taint[<] 10}
1142: ]
1143: ]
1144:
1145: @file[]
1146: ^mail:send[
1147: $.from[paf]
1148: $.to[paf]
1149: $.file[^file::load[binary;image.jpg]]
1150: ]
1151:
1152: @text-n-file[]
1153: ^mail:send[
1154: $.from[paf]
1155: $.to[paf]
1156: $.text[
1157: $.value[this is text value]
1158: ]
1159: $.file[^file::load[binary;image.jpg]]
1160: ]
1161:
1162: @text-n-html-n-file[]
1163: ^mail:send[
1164: $.from[paf]
1165: $.to[paf]
1166: $.text[
1167: $.value[this is text value]
1168: ]
1169: $.html[
1170: $.COntent-type[$.value[text/html]$.charset[windows-1251xx]]
1171: $.value{this is <b>html</b> value ^taint[<] 10}
1172: ]
1173: $.file[^file::load[binary;image.jpg]]
1174: ]
1175:
1176:
1177:
1178: @md5salt[]
1179: 1234
1180:
1181: @cryptdocsample[]
1182: $users[^table::create{name password
1183: alice ***
1184: bob ***
1185: }]
1186:
1187: $htpasswd[^table::create[nameless]{}]
1188: ^users.menu{
1189: ^htpasswd.append{$users.name:^math:crypt[$users.password;^$apr1^$^md5salt[]]}
1190: }
1191:
1192: ^htpasswd.save[nameless;.htpasswd-parser-test]
1193:
1.73 paf 1194:
1195: @tcrypt[]
1.76 paf 1196: #^math:crypt[123;^$apr1^$1234567890abcdef]<br>
1197: ^math:crypt[123;^$apr1^$]<br>
1.72 paf 1198:
1199: @tfilespec[]
1200: src=$selffilespec<br>
1201: dirname=^file:dirname[$selffilespec]<br>
1202: basename=^file:basename[$selffilespec]<br>
1203: justname=^file:justname[$selffilespec]<br>
1204: justext=^file:justext[$selffilespec]<br>
1.68 paf 1205:
1206: @datecreatestring3[]
1207: $new_after[^date::now(-3)]
1208: $articles[^table::create{id title last_update
1209: 1 привет 2002-07-03}]
1210: ^articles.menu{
1211: $last_update[^date::create[$articles.last_update]]
1212: <a href=${articles.id}.html>$articles.title</a>
1213: ^if($last_update > $new_after){новая}
1214: <br>
1215: }
1.67 paf 1216:
1217: @div[]
1218: $var(5)
1219: ^var.inc(7)
1220: ^var.dec(3)
1221: ^var.div(4)
1222: ^var.mul(2)
1223: $var
1224:
1225:
1226: @xdocsave[]
1227: $document[^xdoc::create{<?xml version="1.0" encoding="windows-1251" ?>
1228: <document>
1229: строка1<br/>
1230: строка2<br/>
1231: </document>}]
1232: ^document.save[test.xml]
1233:
1234: @xdocstring[]
1235: $document[^xdoc::create{<?xml version="1.0" encoding="windows-1251" ?>
1236: <document>
1237: строка1<br/>
1238: строка2<br/>
1239: </document>}]
1240: ^document.string[
1241: $.method[html]
1242: ]
1243:
1244:
1245: @xdocload[]
1246: $document[^xdoc::load[article.xml]]
1247: $response:body[^document.file[$.media-type[text/xml]]]
1248:
1249:
1250: @xdoccreatetag[]
1251: $document[^xdoc::create[document]]
1252: $paraNode[^document.createElement[para]]
1253: $dummy[^document.documentElement.appendChild[$paraNode]]
1254: $response:body[^document.file[$.media-type[text/xml]]]
1255:
1256:
1257: @xdoccreate[]
1258: $document[^xdoc::create{<?xml version="1.0" encoding="windows-1251" ?>
1259: <document>
1260: текст
1261: </document>}]
1262: $response:body[^document.file[$.media-type[text/xml]]]
1263:
1264: @selectBool2[]
1265: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
1266: <t attr="привет" n="123"/>}]
1267: ^if(^d.selectBool[/t/@n > 10]){
1268: /t/@n больше 10
1269: }{
1270: не больше
1271: }
1272:
1273:
1274: @selectNumber2[]
1275: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
1276: <t attr="привет" n="123"/>}]
1277: ^d.selectNumber[number(/t/@n)+1]<br>
1278: ^d.selectNumber[2*2]<br>
1279:
1280:
1281: @selectString2[]
1282: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
1283: <t attr="привет" n="123"/>}]
1284: # результат=привет
1285: ^d.selectString[string(t/@attr)]
1286:
1287:
1288: @selectSingle2[]
1289: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
1290: <t attr="привет" n="123"/>}]
1291: # результат=один элемент "t"
1292: $element[^d.selectSingle[t]]
1293: # результат=2 (количество атрибутов <t>)
1294: Количество атрибутов: ^element.attributes._count[]<br>
1295: # результат=не существует (нет <x>)
1296: ^if(^d.select[x]){
1297: x существует
1298: }{
1299: x не существует
1300: }
1301:
1302: @select2[]
1303: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><t attr="привет" n="123"/>}]
1304: # результат: список из одного элемента "t"
1305: $list[^d.select[t]]
1306: # результат: 2 = количество атрибутов <t>
1307: ^list.0.attributes._count[]<br>
1308: ^for[i](0;$list-1){
1309: $attr[$list.$i]
1310: $attr.nodeName = $attr.nodeType<br>
1311: }
1312:
1313:
1314: @selectt[]
1315: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><t attr="привет" n="123"/>}]
1316: $list[^d.select[t]]
1317: ^list.0.attributes._count[]
1.65 paf 1318:
1319: @envt[]
1.66 paf 1320: $f[^file::exec[showenv.cmd;
1321: $.bad[value]
1322: $.CGI_good[value]
1323: ]]
1.65 paf 1324: $f.status<br>
1325: $f.stderr<br>
1326: <pre>$f.text</pre>
1327:
1.63 paf 1328:
1329: @tserge[]
1.64 paf 1330: ^if(" 09 "){y}
1.61 paf 1331:
1332: @datetest[]
1333: $f[^file::stat[some.zip]]
1334: Размер в байтах: $f.size<br>
1335: Год создания: $f.cdate.year<br>
1336: $now[^date::now[]]
1337: $DAYS_CONSIDERED_NEW(3)
1338: Статус: ^if($f.mdate >= $now-$DAYS_CONSIDERED_NEW){новый;старый}
1339:
1.60 paf 1340:
1341: @checkList[]
1342: ...^oneOf[a;a,b,c]...<br>
1343: #...^oneOf[a;ax,b,c]...<br>
1344: ...^oneWord[word]...<br>
1345: #...^oneWord[wo rd]...<br>
1346:
1347:
1348: @oneOf[s;list][t] выдаёт строку, если строка она есть в списке(разделенном запятыми)
1349: $t[^list.lsplit[,]]
1350: ^if(!^t.locate[piece;$s]){^throw[user;$s;unknown]}
1351: $result[$s]
1352:
1353: @oneWord[s]
1354: ^if(^s.match[\W]){^throw[user.data;$s;not word]}{$s}
1.59 paf 1355:
1356: @pngsize[]
1357: $i[^image::measure[test.png]]
1358: ^i.html[]
1359:
1360:
1361: @forkeys[]
1362: $text[^form:fields.foreach[key;val]{$key=$val
1363: }]
1364: ^text.save[ttt.txt]
1365: =$text=
1366:
1367:
1368: @tstoredproc2[]
1369: ^connect[odbc://DSN=nestle^;UID=nestle^;PWD=mbm32]{
1370: ^void:sql{exec pafvoid}
1371: }
1372:
1373: @tstoredproc[]
1374: ^connect[odbc://DSN=nestle^;UID=nestle^;PWD=mbm32]{
1375: $t[^table::sql{exec pafproc}]
1376: # $t[^table::sql{{call pafproc}}]
1377: $c[^t.columns[]]
1378: ^c.menu{$c.column}[<br>]
1379: }
1.57 paf 1380:
1381: @datecreatestring2[]
1.58 paf 1382: <table border=1>
1383: ^datecreatestring2show[2000]
1384: ^datecreatestring2show[2000-02]
1.59 paf 1385: ^datecreatestring2show[2000-2-03]
1.58 paf 1386: ^datecreatestring2show[2000-02-03 15]
1387: ^datecreatestring2show[2000-02-03 15:30]
1388: ^datecreatestring2show[2000-02-03 15:30:04]
1389: ^datecreatestring2show[2000-02-03 15:30:04 hren]
1390: ^datecreatestring2show[15:30]
1391: ^datecreatestring2show[15:30:05]
1392: ^datecreatestring2show[15:30:05 hren]
1393: </table>
1394:
1395: @datecreatestring2show[s]
1396: $date[^date::create[$s]]
1397: <tr>
1398: <td>$s</td><td align=right>^date.sql-string[]</td>
1399: </tr>
1400:
1.57 paf 1401:
1402: @junctionprob[][l]
1403: $l[123]
1404: $a{$l}
1405: ^junctionprobnested[$a]
1406: @junctionprobnested[p]
1407: $p
1408:
1409:
1410: @callindirecttarget[]
1411: callindirecttarget called
1412: @callindirect[]
1413: $f[$callindirecttarget]
1414: ^f[]
1415:
1416: @xpath2[]
1417: $xdoc[^xdoc::create{<?xml version="1.0" encoding="windows-1251"?>
1418: <doc>
1419: <field-list>
1420: <field name="aa"/>
1421: <field name="bb"/>
1422: </field-list>
1423: </doc>
1424: }]
1425:
1426: #^xdoc.string[]
1427:
1428: $fieldList[^xdoc.selectSingle[/doc/field-list]]
1429: #^fieldList.childNodes._count[]
1430: $fields[^fieldList.select[field]]
1431: #^fields._count[]
1432: ^fields.foreach[k;node]{
1433: $node.nodeName<br>
1434: }
1435: @counter[filespec][f;s]
1436: ^file:lock[$filespec]{
1437: $f[^file::load[text;$filespec]]
1438: $s[^eval($f.text+1)]
1439: ^s.save[$filespec]
1440: }
1441: $s
1.56 paf 1442:
1443: @xmlspace[]
1444: $xdoc[^xdoc::set{^process{<?xml version="1.0" encoding="windows-1251"?>
1445: <!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
1446: <people>
1447: <man id="1" имя="word слово">
1448: <name>1 2</name>
1449: </man>
1450: </people>
1451: }}]
1452: $xdoc[^xdoc.transform[global.xsl]]
1453: $string[^xdoc.string[$.method[html]]]
1454: ^string.save[a]
1455: ^untaint[html]{$string}
1456:
1457: @badthrows[]
1458: #^throw[a;b;]
1459: ^throw[a;]
1.54 paf 1460:
1461: @mssqltypes1[]
1462: ^connect[odbc://DSN=nestle^;UID=nestle^;PWD=mbm32]{
1.55 paf 1463: # ^string:sql{select { ts '1998-05-02 01:23:56.123' }}
1464: # ^string:sql{select CAST({ ts '1998-05-02 01:23:56.123' }AS smalldatetime)}
1465: # ^string:sql{select CAST({ts '2002-04-28 00:00:00.000'} AS smalldatetime)}
1466: $t[^table::sql{select a from paf}]
1467: ^t.count[]
1.54 paf 1468: }
1.51 paf 1469:
1.53 paf 1470: @datecreatestring[]
1.54 paf 1471: $d[^date::create[2002-04-33 01:03:04]]
1.53 paf 1472: ^d.sql-string[]
1.52 paf 1473:
1474: @method[hash]
1475: $hash.key
1476: @mainZ[]
1477: ^method[
1478: $.key{code}
1479: ]
1480:
1.51 paf 1481: @tablehasht[]
1482: $t[^table::create{p
1483: 1
1484: 3
1485: 2
1486: 4}]
1487:
1488: $h[^t.hash[p]]
1489:
1490: =^h._count[]=
1491:
1492:
1493: @sqldefaults[]
1494: ^connect[mysql://mdm:4b833ljq@db-mysql/mdm]{
1495: ^int:sql{select news_id from news where news_id=-1}[$.default{2}]<br>
1496: ^string:sql{select news_id from news where news_id=-1}[$.default{2}]
1497: }
1.60 paf 1498: =======
1499: <hr>
1500: OK
1501: >>>>>>> 1.50
1.48 paf 1502:
1503: @tcrashlocaljunctionsv2[]
1504: $a[
1505: $b{ $c[1] }
1506: ]
1507: $b
1508: $c
1509:
1510: @tcrashlocaljunctions[]
1511: $var[aaa]
1512: ^if(1){
1513: ^tcrashlocaljunctions1[]
1514: }
1515:
1516: $j
1517:
1.49 paf 1518: @tcrashlocaljunctions1[][var]
1519: $var[varvalue]
1.48 paf 1520: $j{
1521: $var
1522: }
1.49 paf 1523: $j
1.48 paf 1524:
1525: @tjunctions[][tl]
1526: $t[^t::create[]]
1527: ^tjunctionsi[]
1528:
1529: @tjunctionsi[][tl]
1530: $tl[12345]
1531: ^t.tjunctionsm[
1532: $.key{
1533: $tl
1534: }
1535: ]
1.46 paf 1536:
1.47 paf 1537: @replacetest[]
1538: $b[b]
1539: $s[
1540: aaaaaaaaaa${b}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1541: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa${b}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1542: ]
1543: ^s.replace[^table::create{from to
1544: ba !_}]
1545:
1546:
1.46 paf 1547: @matchoptionpp[]
1.47 paf 1548: #$ORIGINS(1)
1.46 paf 1549: $s[
1550: aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1.47 paf 1551: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1552: aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1553: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1554: aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1555: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1556: aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1557: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1558: aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1559: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1.46 paf 1560: ]
1561: ^s.match[b;g']{($match.prematch|$match.match|$match.postmatch)}
1562:
1.44 paf 1563:
1564: @txdocxnodechild[]
1565: $xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?><d/>}]
1566: $xdoc.nodeName
1567: ^xdoc.selectNumber[2*2]
1.45 paf 1568: $xdoc:ELEMENT_NODE
1.44 paf 1569:
1570:
1571: @tclasses[]
1572: $t[^t::create[]]
1573: ^t.method[]
1574: <hr>
1575: ^t.base_method[]
1576:
1.40 paf 1577:
1578: @errort[]
1.42 paf 1579: ^xdoc::create[a]
1.40 paf 1580: #^throw[user;here;this]
1581:
1582: @tselectNumber[]
1583: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><d attr="привет" n="123"/>}]
1584: ^d.selectString[string(d/@attr)]<br>
1585: ^d.selectNumber[2*2]<br>
1586: ^d.selectNumber[number(/d/@n)+1]<br>
1587:
1.34 paf 1588:
1.36 paf 1589: @invaliddate2[]
1590: $d[^date::create(1018946575/60/60)] ^d.sql-string[]
1591:
1592: @process2[]
1593: ^^process{
1594: ^process{
1595: ^$a[^^if(0){^$.k[y]}{^$.k[^^hren[]n]}] ^$a.k
1596: }
1597: }
1598:
1.35 paf 1599: @casehashtext[]
1600: $tt[1]
1601: $tmp[
1602: ^switch[$tt]{
1603: ^case[1]{
1604: $.aaa[123]
1605: }
1606: ^case[DEFAULT]{
1607: $.bbb[456]
1608: }
1609: }
1.36 paf 1610: shit!
1.35 paf 1611: ]
1.36 paf 1612: #$tmp
1.35 paf 1613: $tmp.aaa
1614:
1615: @subjvaltest[]
1616: $a12[val]
1617: $b[12]
1618: $a$b
1619:
1.34 paf 1620: @tableselect0[]
1621: $person[^table::create{name height
1622: paf 1.77
1623: шохин 2.07
1624: moko 1.77
1625: }]
1626: $nottoohigh[^person.select($person.height<2)]
1627: ^nottoohigh.menu{$nottoohigh.name<br>}
1.32 paf 1628:
1629: @transparams[]
1630: $idoc[^xdoc::create{<?xml version="1.0" ?><doc/>}]
1631: $odoc[^idoc.transform[global.xsl;
1632: $.param1['1']
1633: $.param2['2']
1634: ]]
1635: <pre>^taint[^odoc.string[$.method[html]]]
1636:
1637: @memnotest1[]
1638: ^for[i](0;4000){
1639:
1640: $xxxx[$i]
1641: $xxxx
1642:
1643: }
1644:
1645: @memnotest1notes[]
1646: одна итерация цикла:
1647: [Mon Apr 8 20:12:02 2002] execution-------------------------|
1.35 paf 1648: '469641+=28 wcodeframe -> 0 !optimize[3]''469669+=49 string от {} -> 0 optimize[3]'
1.32 paf 1649: [Mon Apr 8 20:12:02 2002] 12:STRING__WRITE
1650: [Mon Apr 8 20:12:02 2002] "|| "
1651: [Mon Apr 8 20:12:02 2002] 12:WITH_ROOT
1652: [Mon Apr 8 20:12:02 2002] 13:VALUE
1653: [Mon Apr 8 20:12:02 2002] "xxxx" string
1.35 paf 1654: [Mon Apr 8 20:12:02 2002] 14:CREATE_EWPOOL'469377+=24 wcodeframe -> 0 !optimize[1]''469401+=49 string -> 41 !optimize[7]'
1.32 paf 1655: [Mon Apr 8 20:12:02 2002] 16:WITH_READ
1656: [Mon Apr 8 20:12:02 2002] 17:VALUE
1657: [Mon Apr 8 20:12:02 2002] "i" string
1658: [Mon Apr 8 20:12:02 2002] 18:GET_ELEMENT
1.35 paf 1659: [Mon Apr 8 20:12:02 2002] 17:WRITE_VALUE'469452+=40 MAX_NUMBER -> !~2 actual digits''469492+=49 -> 41 !'
1660: [Mon Apr 8 20:12:02 2002] 16:REDUCE_EWPOOL'469541+=24 VString -> 0 optimize[5]'
1.32 paf 1661: [Mon Apr 8 20:12:02 2002] 15:CONSTRUCT_VALUE
1662: [Mon Apr 8 20:12:02 2002] 12:STRING__WRITE
1663: [Mon Apr 8 20:12:02 2002] "| "
1664: [Mon Apr 8 20:12:02 2002] 12:WITH_READ
1665: [Mon Apr 8 20:12:02 2002] 13:VALUE
1666: [Mon Apr 8 20:12:02 2002] "xxxx" string
1667: [Mon Apr 8 20:12:02 2002] 14:GET_ELEMENT
1668: [Mon Apr 8 20:12:02 2002] 13:WRITE_VALUE'469573+=41 string expand nothing for now'
1669: [Mon Apr 8 20:12:02 2002] 12:STRING__WRITE
1.35 paf 1670: [Mon Apr 8 20:12:02 2002] "||"'469617+=24 VString -> 0 !optimize[6]'
1.32 paf 1671: [Mon Apr 8 20:12:02 2002] <-ja returned
1672: [Mon Apr 8 20:12:02 2002] ja->
1673:
1674: 201/328=0.612804878049 %%optimized
1675:
1676: 1.
1677: CREATE_*POOL
1678: сделать
1679: *POOL_POOLED+CODE
1680: где
1681: wwrapper
1682: и(возможно) wcodeframe
1683: +string
1684: стековая переменная
1685:
1686: 2.
1687: избавиться от обёртки при возврате результата process [см. тело _for]
1688:
1689: 3.
1690: сделать callback для process, чтобы вынести invariants из _for & co.
1691:
1692: 4.
1693: @todo склеить get_element и write_value (при вставлении? write_value)
1694:
1695: 5.
1696: reduce_*pool -> вариант получить именно string, без VString обёртки [часто
1697: обёртка сразу выбрасывается = не нужна]
1698:
1699: 6.
1700: process вариант получить именно string, без VString обёртки [часто обёртка
1701: сразу выбрасывается = не нужна]
1702:
1703: 7.
1704: string head, убить 8 байт неправильной link
1.31 paf 1705:
1706: @voidparams[]
1707: ^voidparamsm[$form:field]
1708:
1709: @voidparamsm[p]
1710: ^p.int(123)
1.29 paf 1711:
1.30 paf 1712: @rolls2[]
1713: $now[^date::now[]]
1714: $d[^date::create($now.year;$now.month)] ^d.sql-string[]<br>
1715: ^for[i](1;12){
1716: ^d.roll[month](-1) ^d.sql-string[]<br>
1717: }
1718:
1.29 paf 1719: @cacheexpireschanging[]
1720: ^cache[$DB_HOME/keyключ][^date::now(+1)]{ ^rem{1 day}
1721: ^cache[^date::now(+4/24/60/60)]
1722: # ^cache(2)
1.30 paf 1723: # ^cache(0)
1.29 paf 1724: ^math:random(100)
1725: }
1726:
1727:
1728:
1729: @cacheexpiresfixed[]
1730: ^cache[$DB_HOME/keyключ][^date::now(+2/24/60/60)]{
1731: ^math:random(100)
1732: }
1733:
1734: @dateoffsets[]
1735: $d[^date::create(^date::now[]+1/24/60)]
1736: #$d[^date::now(+1/24/60)]
1737: ^d.sql-string[]
1738: #$d
1.26 paf 1739:
1.28 paf 1740: @exceptionTypes[]
1741: # parser.compile ^test[} компиляция (непарная скобка, ...)
1742: # parser.runtime ^if(0). параметры (больше/меньше, чем нужно, не тех типов, ...)
1743: # number.zerodivision ^eval(1/0) ^eval(1%0)
1744: # number.format ^eval(abc*5)
1745: # file.missing ^file:delete[delme] not found
1746: # file.access ^table::load[.] no rights
1747: # image.format ^image::measure[index.html] not gif/jpg
1748: # sql.connect ^connect[mysql://baduser:pass@host/db]{} not found/timeout
1749: # sql.execute ^connect[mysql://okuser:pass@host/db]{^void:sql{select bad}} syntax error
1750: # xml ^xdoc::create{<forgot?>} any error in xml/xslt libs
1751: # smtp.connect not found/timeout
1752: # smtp.execute communication error
1753:
1.26 paf 1754: @roll2[]
1755: $d[^date::create(2002;4;2;2;2;3)] ^d.sql-string[]<br>
1.27 paf 1756: ^d.roll[day](+365*3+1) ^d.sql-string[]<br>
1.26 paf 1757:
1.25 paf 1758:
1759: @rolls[]
1760: $d[^date::create(2002;4;4)]
1761: ^d.sql-string[]<br>
1762: ^for[i](1;7){
1763: ^d.roll[day](-1)
1764: ^d.sql-string[]<br>
1765: }
1766: <hr>
1767: $d[^date::create(2002;3;28)]
1768: ^d.sql-string[]<br>
1769: ^for[i](1;7){
1770: ^d.roll[day](+1)
1771: ^d.sql-string[]<br>
1772: }
1773: <hr>
1774: $d[^date::create(2002;12;3)]
1775: ^d.sql-string[]<br>
1776: ^for[i](1;14){
1777: ^d.roll[day](-1)
1778: ^d.sql-string[]<br>
1779: }
1780: <hr>
1781: $d[^date::create(2002;10;19)]
1782: ^d.sql-string[]<br>
1783: ^for[i](1;14){
1784: ^d.roll[day](+1)
1785: ^d.sql-string[]<br>
1786: }
1787:
1788:
1789:
1790:
1791:
1.22 paf 1792:
1793: @exceptions1[]
1794: ^try{
1795: aaa
1.24 paf 1796: ^throw[custom1;paf;is stupid]
1.22 paf 1797: }{
1.24 paf 1798: ^if($exception.type eq custom1){
1.28 paf 1799: # $exception.handled(1)
1800: ^throw[$exception]
1.24 paf 1801: type=$exception.type<br>
1802: source=$exception.source<br>
1803: file=$exception.file<br>
1804: lineno=$exception.lineno<br>
1805: comment=$exception.comment<br>
1806: }
1.22 paf 1807: }
1.21 paf 1808:
1809: @locate_by_expr[]
1810: $t[^table::create{a b
1811: 1 nok
1812: 2 ok
1813: 3 nok
1814: }]
1815: ^if(^t.locate($t.a==2)){$t.b}{n}
1.17 paf 1816:
1817: @method_junction_params[param]
1818: ^if($param is junction){junction}{ne junction}
1819:
1820: @verifyCookie[value]
1821: ^if($cookie:dummyvote eq $value){
1822: $result(1)
1823: }{
1824: $cookie:dummyvote[$value]
1825: $result(0)
1826: }
1.16 paf 1827:
1828: @execlangs[]
1.20 paf 1829: $f[^file::exec[test.pl]]
1.36 paf 1830: err:$f.stderr<br>
1.16 paf 1831: ^process{$f.text}
1832: #$c[^t.columns[]]
1833: #^c.menu{
1834: #* $c.column<br>
1835: #}
1.36 paf 1836: c:$t.c<br>
1.16 paf 1837:
1838: @tobjeresult[]
1839: ^table::create{a
1840: 12}
1.15 paf 1841:
1842: @xmlprobs[]
1843: $xmlDataType[^xdoc::load[program.xml]]
1844: #<pre>^taint[^xmlDataType.string[]]
1845: $xmlDataTypes[^xmlDataType.select[programs/program[@id=4]/data]]
1846: #=^xmlDataTypes._count[]=
1847: =^xmlDataTypes.0.getAttribute[type-id]=
1848:
1849: @doubleprobs[]
1850: $1(^math:radians(180))
1851: $2($math:PI)
1852: ^if(^1.format[%.10f]==^2.format[%.10f]){y;n}
1853: ^if($1==$2){y;n}
1854: ^if(^math:radians(180)==$math:PI){y;n}
1855:
1856:
1857: @divnamestop[]
1858: $a(10)
1859: ^eval($a\3)
1860:
1861: @arrayclone[]
1862: $t[^table::create{a b
1863: 1 11
1864: 2 22
1865: }]
1866: $c[^table::create[$t]]
1867: ^c.append{2 33}
1868: ^t.count[]
1869: ^c.count[]
1870:
1871: @operator_tricks[]
1872: ^if(1){$a[^t[]]}
1873: $a!
1874: $a($b)
1875: ^if(1){y}{n}
1876: $MAIN:a(^t[] eq OK)
1877: #$MAIN:a(1)
1878: ^if($a){y}{n}
1879: #^if(1){y}{n}
1880: $form:if
1881: $a[$.n[1]]
1882: $a.if
1883:
1884: @xoutputrusattr[]
1885: $d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><d attr="привет"/>}]
1886: ^show_xdoc2[$d]
1887:
1888: @xdocset1[]
1889: $d[^xdoc::set{<?xml version="1.0"?><d>=^taint[&]=</d>}]
1890: ^show_xdoc2[$d]
1891:
1892: @regexp3[]
1893: $s[abcАБВ]
1894: ^if(^s.match[][i]){y}{n}
1895:
1896:
1897: @exec2[]
1898: $a[^file::exec[bin/t.cmd]]
1899: <pre>^taint[$a.text]</pre>|$a.status|$a.stderr<hr>
1900:
1901:
1902: @tlock[]
1903: ^file:lock[lockfile]{
1904: code
1905: }
1906:
1907: @xmloutattrwithoutvalue[]
1908: #$ORIGINS(1)
1909: $doc[^xdoc::set{<?xml version="1.0"?><doc background="">zz</doc>}]
1910: $doc[^doc.transform[global.xsl]]
1911: =^taint[html][^doc.string[$.method[html]]]=
1912:
1913:
1914:
1915: @precisionProblem[]
1916: $a[123456789012345678901234567890]
1917: $b(^a.double[])
1918: ^b.format{%.20E}
1919: <hr>
1920: ^eval(2*2)
1921:
1922: @xpath[]
1923: $xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?>
1924: <document><block><p>привет</p></block></document>
1925: }]
1926: #^show_xdoc2[$xdoc]
1927: $node[^xdoc.selectSingle[/document/block/p]]
1928: ^if(def $node){
1929: ^if($node is string){
1930: $node
1931: }{
1932: ^if($node is hash){
1933: ^node._count[]
1934: }{
1935: $node.nodeType
1936: }
1937: }
1938: #$node.firstChild.nodeValue
1939: }{
1940: node not found
1941: }
1942:
1943:
1944: @ttablesetlang[]
1945: $a-tab-b[a b
1946: 1 2]
1947:
1948: $t[^table::set{$a-tab-b}]
1949: =$t.a=
1950: <hr>
1951:
1952: $t[^table::set[nameless]{^taint[$a-tab-b]}]
1953: =$t.0=
1954: <hr>
1955:
1956: $t[^table::set{^untaint{^taint[$a-tab-b]}}]
1957: =$t.a=
1958:
1959: #^t.append{1 2}
1960:
1961: @mail3[]
1962: ^mail:send[
1.98 paf 1963: $.from[Александр Петросян <paf@mail.design.ru>]
1964: $.to[Александр Петросян <paf@mail.design.ru>]
1965: $.subject[проверка2]
1.15 paf 1966: $.body[
1967: $.text[
1968: $.content-type[$.value[text/plain] $.charset[windows-1251]]
1.98 paf 1969: $.body[проверка^taint[uri][москва]=]
1.15 paf 1970: ]
1971: $.attachment[
1972: $.value[^file::load[text;index.html]]
1973: $.file-name[привет всем.html]
1974: ]
1975: ]
1976: ]
1977:
1978:
1979: @ttime[]
1980: $now[^date::now[]]
1981: $now.hour:$now.minute
1982:
1983: @tupper[]
1984: $t[abcABCабвАБВ]
1985: $t<br>
1986: ^t.upper[]
1987:
1988: @treplace[]
1989: $copy-paste-clean[^table::set{a b
1990: . _
1991: , _
1992: + _
1993: & _
1994: ? _
1995: = _}]
1996:
1997: $cache_key[^taint[в.а,с+я]&был?тут=недавно.cache]
1998: # почему-то этот replace роняет апач в 500 ошибку :(
1999: #^cache_key.replace[$copy-paste-clean]
2000: $test[abc]
2001: ^test.save[$cache_key]saved<br>
2002: $cache[^file:list[.;\.cache^$]]
2003: ^file:delete[$cache_key]deleted($cache.name)<br>
2004:
2005:
2006:
2007: @xslt2[]
2008: $xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?>
2009: <document><block><p>привет</p></block></document>
2010: }]
2011: ^show_xdoc2[$xdoc]
2012: ^show_xdoc2[^xdoc.transform[templates/_document.xslt]]
2013: <hr>
2014:
2015:
2016: @tcache2[]
2017: ^cache[$DB_HOME/keyключ](2){
2018: ^math:random(100)
2019: }
2020:
2021: @ttaintuntaint[]
2022: <!-- некий панковский заголовок с буковкой C в круглых скобках -->^taint[html][
2023:
2024: ]zz
2025: <hr>
2026: ^untaint[html]{1^taint[ ]2 3}
2027:
2028:
2029: @tappend2[]
2030: $t[^table::set{a b}]^t.append{1 2}$t.a
2031:
2032: @badvsnprintf[]
2033: ^connect[zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz]{
2034: }
2035:
2036:
2037: @badoracequoting[]
2038: $SQL.connect-string[oracle://webspb:webpwd@mts?NLS_LANG=RUSSIAN_AMERICA.CL8MSWIN1251&NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS]
2039: ^connect[$SQL.connect-string]{
2040: ^void:sql{delete from paf}
2041: ^void:sql{insert into paf values (1, '$form:text')}
2042: $paf[^table::sql{select * from paf}]
2043: ^paf.menu{
2044: $paf.id: ^untaint{$paf.block}<hr>
2045:
2046: }
2047: <hr>
2048:
2049:
2050: ^rem{
2051: $news[^table::sql{select description from news}[$.limit(3)]]
2052: ^news.menu{
2053: ^untaint{$news.description}<hr>
2054:
2055: }
2056: <hr>
2057: }
2058:
2059: $tables[^table::sql{select table_name from user_tables}]
2060: ^tables.menu{
2061: $tables.table_name<br>
2062: }
2063:
2064: }
2065: <hr>
2066: $env:PATH
2067:
2068: @badconstructors[]
2069: $bred[^string::length[]]
2070: $bred[^response::clear[]]
2071: $bred[^int::int[]]
2072:
2073:
2074: @xloadwrongtable[]
2075: $constr[^xdoc::load[wrongtable.xml]]
2076: ^show_xdoc2[$constr]
2077:
2078: @xsetwrongtable[]
2079: $constr[^xdoc::set{<?xml version="1.0" encoding="windows-1251z" ?>
2080: <block-list>^untaint[as-is]{$constructor}</block-list>}]
2081:
2082:
2083: @tablecolumnerror[]
2084: $t[^table::set{a}]
2085: $t.$a
2086:
2087: @roll[]
2088: #$date[^date::set(1970;1;2)]
2089: #^date.roll[month](-1)
2090: $date[^date::set(2038;1;1)]
2091: ^date.roll[month](+1)
2092: $date.year $date.month $date.day
2093:
2094: @cookie2[]
2095: #=$cookie:clientType[$.value[test]]=<br>
1.159 paf 2096: =$cookie:CLASS.clientType=<br>
1.15 paf 2097:
2098:
2099: @tableset[]
2100: $a[^table::set{a
2101: 1
2102: 2}]
2103: ^eval(100\$a)
2104:
2105:
2106:
2107: @zzz[]
2108:
2109:
2110: $constructor[
2111: <block1 name="main_srvr" type="0" label="Основное тело" />
2112: <block2 name="main_srvr2" type="0" label="Основное тело" />
2113: ]
2114:
2115: $constr[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?>
2116: <block-list>^untaint[as-is]{$constructor}</block-list>}]
2117:
2118: $children[$constr.documentElement.childNodes]
2119: ^if($children){
2120: ^for[i](1;^children._count[]){
2121: $node[$children.$i]
2122: $node.nodeName<br>
2123: }
2124: }
2125:
2126:
2127: @thashforeach3[]
2128: $h[
2129: $.a[1]
2130: $.b[2]
2131: ]
2132: $c[^table::set{a
2133: ^h.foreach[key;value]{$value
2134: }}]
2135: $c.a
2136:
2137: @thashforeach2[]
2138: $h[
2139: $.a[1]
2140: $.b[2]
2141: ]
2142: $c[
2143: ^h.foreach[key;value]{
2144: $.$key[$value]
2145: }
2146: ]
2147: $c.b
2148:
2149: @thashforeach[]
2150: $h[
2151: $.a[1]
2152: $.b[2]
2153: ]
2154: ^h.foreach[key;value]{
2155: $key=$value<br>
2156: }
2157:
2158: @thashdelete[]
2159: $h[$.a[1] $.b[2]]
2160: was:<br>
2161: count=^h._count[] <br>
2162: b='$h.b' <br>
2163:
2164: ^h.delete[b]
2165:
2166: now:<br>
2167: count=^h._count[] <br>
2168: b='$h.b'
2169:
2170: @sappend[]
2171: $test[123]
2172: ^test.save[test]
2173: ^test.save[append;test]
2174:
2175: @tappend[]
2176: $test[^table::set{a b
2177: a1 b1}]
2178: ^test.save[test]
2179: $test[^table::set{a b
2180: a2 b2}]
2181: ^test.save[append;test]
2182:
2183:
2184: @tform[]
2185: ^if(def $form:new_file){y}{n}
2186: <form method="post" enctype="multipart/form-data">
2187: <input type="file" name="new_file" />
2188: <input type=submit>
2189: </input>
2190:
2191: @formattest[]
2192: $size(15.124)
2193:
2194: ^size.format{%.2f}
2195:
2196: @filelist[]
2197: $html[^file:list[.;\.html^$]]
2198: ^html.menu{
2199: $html.name<br>
2200: }
2201: <hr>
2202:
2203: @безнадёжна_попытка_поправить_непоправимое[]
2204: $dom_from_disk[^xdoc::load[input.xml]]
2205: $dom_created_in_air[^xdoc::create[doc]]
2206: ^dom_created_in_air.documentElement.appendChild[^dom_from_disk.documentElement.cloneNode(1)]
2207: ^show_xdoc2[$dom_created_in_air]
2208:
2209:
2210: @tcache[]
2211: #^hashfile:clear[cache]
2212: $code[^hashfile::open[$DB_HOME;cache]]
2213: ^code.cache[key](2){
2214: ^math:random(100)
2215: # ^code.delete[]
2216: }
2217:
2218: @thashfileexp[]
2219: $hf[^hashfile::open[$DB_HOME;hashfile]]
2220: $hf.paf[$.value[крут] $.expires(3)]
2221: paf=$hf.paf
2222: <hr>
2223: ^hf.foreach[key;value]{
2224: $key=$value<br>
2225: }
2226: <hr>
2227: $hash[^hf.hash[]]
2228: =$hash.paf=
2229: <hr>
2230:
2231: @tcounter[]
2232: ^tcounterone[$DB_HOME]
2233: other root:
2234: ^tcounterone[${DB_HOME}2]
2235: again, first:
2236: ^tcounterone[$DB_HOME]
2237:
2238: @tcounterone[DB_HOME]
2239: $counter[^hashfile::open[$DB_HOME;counter]]
2240: #^counter.clear[]
2241: ^counter.transaction{
2242: # $counter.value(10)
2243: $counter.value($counter.value+1)
2244: # ^counter.delete[value]
2245: $counter.value
2246: }
2247: <hr>
2248: ^rem{
2249: $hash[^counter.hash[]]
2250: =$hash.value=
2251: <hr>
2252: }
2253:
2254: @tablehash[]
2255: $productList[^table::set{id name
2256: 1 носки
2257: 2 валенки
2258: 3 ушанка
2259: }]
2260:
2261: #скажем, у первого дилера
2262: $firstPriceList[^table::set{id price
2263: 1 0.3
2264: 3 1000
2265: }]
2266:
2267: $firstPriceHash[^firstPriceList.hash[id]]
2268:
2269: ^productList.menu{
2270: продукт "$productList.name" | цена у first: $firstPriceHash.[$productList.id].price<br>
2271: }
2272:
2273:
2274: @hashfile[]
2275: $hf[^hashfile::assign[hashfile]]
2276: #$hf.paf[крут5]
2277: paf=$hf.paf
2278:
2279: @formclass[]
2280: ^$form:CLASS.a=$form:CLASS.a
2281:
2282: @domdata[]
2283: ^if(1){
2284: # $a{^hren[]}
2285: }
2286: $a
2287: $xdoc[^xdoc::create[doc]]
2288: $doc[$xdoc.documentElement]
2289: $name[^doc.appendChild[^xdoc.createElement[name]]]
2290: $text[^name.appendChild[^xdoc.createTextNode[петросян&coz]]]
2291: ^untaint[as-is]{=$text.nodeValue=}
2292:
2293: @domedit[]
2294: ^domdata[]
2295: #$paf.nodeName<br>
2296: #$doc.documentElement.nodeName<br>
2297:
2298: ^show_xnode1[$xdoc.documentElement;0;1]
2299: <hr>
2300: ^show_xdoc2[$xdoc]
2301: <hr>
2302:
2303: @domxslt[]
2304: ^domdata[]
2305: ^show_xdoc2[^xdoc.transform[global.xsl;$.param1[123/]]]
2306: <hr>
2307:
2308: @lsplit2[]
2309: $path[/optics/]
2310: $pathTable[^path.lsplit[/]]
2311: ^pathTable.menu{
2312: ^if(def $pathTable.piece){
2313: =$pathTable.piece=
2314: }
2315: }
2316:
2317:
2318: @faceesize[]
2319: $k(2)
2320: $pict[^image::load[paf.gif]]
2321: $small[^image::create($pict.width/$k;$pict.height/$k)]
2322: ^small.copy[$pict](0;0;$pict.width;$pict.height;0;0;$small.width;$small.height;250)
2323: $response:body[^small.gif[]]
2324:
2325: @imageresize[]
2326: $k(2)
2327: $pict[^image::create(400*$k;200*$k)]
2328: $pict.line-width(2)
2329: ^pict.arc($pict.width/2;$pict.height/2;$pict.width-1;$pict.height-1;0;360;0x000000)
2330: ^pict.arc($pict.width/2;$pict.height/2;$pict.width-20;$pict.height-20;0+20;360-20;0xff0000)
2331: #^pict.arc($pict.width/2;$pict.height/2;$pict.width;$pict.height;0;360;0xff0000)
2332: ^pict.circle($pict.width/2;$pict.height/2;$pict.height/2-20;0x0000ff)
2333: ^pict.arc($pict.width/2;$pict.height/2;$pict.height-26;$pict.height-26;0+20;360-20;0xff0000)
2334: $response:body[^pict.gif[]]
2335:
2336: #$small[^image::create($pict.width/$k;$pict.height/$k)]
2337: #^small.copy[$pict](0;0;$pict.width;$pict.height;0;0)
2338: #^small.copy[$pict](0;0;$pict.width;$pict.height;0;0;$small.width;$small.height;0)
2339:
2340: #$response:body[^small.gif[]]
2341:
2342:
2343: @tintdefault[]
2344: #$abc[abc]
2345: $abc[33]
2346: ^abc.int[z]
2347: #^abc.int(123)
2348:
2349: @ifassignhash[]
2350: $h[^if(1){$.a(1);$.a(2)}]
2351: $h.a
2352:
2353: @ifpasshash[]
2354: $a[$.e[a]]
2355: $b[$.e[b]]
2356: ^ifpasshashdest[^if(1){$a;$b}]
2357: #$x[^if(1){$a}{$b}]
2358: #^ifpasshashdest[$x]
2359:
2360: @ifpasshashdest[p]
2361: $p.e
2362:
2363: @movedir[]
2364: ^file:move[a;deeper/a]
2365:
2366: @replace[]
2367: $a[12^;3]
2368: ^a.replace[^table::set{from to
2369: 2^; !
2370: }]
2371:
2372:
2373: @set[]
2374: ^setdata[]
2375: ^a.add[$b]
2376: add:$a.3<br>
2377:
2378: ^setdata[]
2379: ^a.sub[$b]
2380: sub2:$a.2<br>
2381: sub1:$a.1<br>
2382:
2383: ^setdata[]
2384: $c[^a.union[$b]]
2385: union3:$c.3<br>
2386: union2:$c.2<br>
2387:
2388: ^setdata[]
2389: $c[^a.intersection[$b]]
2390: intersection3:$c.3<br>
2391: intersection2:$c.2<br>
2392:
2393: ^setdata[]
2394: intersects:^if(^a.intersects[$b]){y;n}<br>
2395: intersects2:^if(^a.intersects[ ]){y;n}<br>
2396:
2397:
2398: <hr>
2399:
2400: @setdata[]
2401: $a[$.1[a1] $.2[a2]]
2402: $b[ $.2[b2] $.3[b3]]
2403:
2404:
2405: @hash[]
2406: $h[^hash::create[$._default[123]]]
2407: $h.paf[not kretin]
2408: $h.paf<br>
2409: =$h.that=<br>
2410:
2411: @methresult[]
2412: $result[^table::set{1}]
2413:
2414: @terror[]
2415: ^error[method z must be called with z]
2416:
2417: @syntax1[]
2418: #^a[^b]
2419:
2420: @syntax2[]
2421: #^a[
2422:
2423: @ssave[]
2424: $abc[abc]
2425: ^abc.save[abc]
2426:
2427: @calendar[]
1.103 paf 2428: $year(2002)
2429: $month(12)
1.84 paf 2430: ${year}-${month}:<br>
2431: $week_days[^date:calendar[rus]($year;$month)]
1.15 paf 2432: <pre>
1.101 paf 2433: ^week_days.menu{^for[wday](0;6){^if($week_days.$wday){$week_days.$wday; ^; ^;} }=$week_days.week,$week_days.year=<br>}
1.15 paf 2434: </pre>
2435:
2436: @thash[]
2437: $table[^table::set{id name age
2438: 1 paf 278
2439: 2 пиф 234
2440: }]
2441: $hash[^table.hash[id;^table::set[nameless]{id
2442: name}]]
2443: $hash.2.id $hash.2.name $hash.2.age
2444:
2445: @tdef[]
2446: $s[0]
2447: if 0=^if($s){}{n}<br>
2448: if def 0=^if(def $s){y}{}<br>
2449: <hr>
2450:
2451: @ford[]
2452: ^for[i](0;5){$i}{($i)}
2453:
2454: @tif[]
2455: ^if[def]{y;n}
2456:
2457: @image[]
2458: $pict[^image::create(400;200)]
2459: ^pict.arc($pict.width/2;$pict.height/2;$pict.width-1;$pict.height-1;0;360;0x000000)
2460: ^pict.arc($pict.width/2;$pict.height/2;$pict.width-10;$pict.height-10;0+10;360-10;0xff0000)
2461: #^pict.arc($pict.width/2;$pict.height/2;$pict.width;$pict.height;0;360;0xff0000)
2462: ^pict.circle($pict.width/2;$pict.height/2;$pict.height/2-10;0x0000ff)
2463: ^pict.arc($pict.width/2;$pict.height/2;$pict.height-26;$pict.height-26;0+10;360-10;0xff0000)
2464: $response:body[^pict.gif[]]
2465:
2466:
2467:
2468: @mail2[]
2469: ^mail:send[
1.139 paf 2470: $.message-id[<6615%1@parser.ru>]
1.15 paf 2471: $.content-type[$.value[text/plain] $.charset[windows-1251]]
2472: $.from[Александр Петросян <paf@design.ru>]
2473: $.to[Александр Петросян <paf@design.ru>]
1.134 paf 2474: $.subject[проверка проверка]
2475: $.text[проверка]
1.15 paf 2476: ]
2477:
2478: @cookie[]
1.115 paf 2479: #$env:HTTP_COOKIE<br>
1.15 paf 2480:
2481: #$cookie:переменная[test тест ТЕСТ2]
2482: =$cookie:переменная=<br>
2483: #$cookie:переменная2[test тест ТЕСТ3]
2484: =$cookie:переменная2=<br>
2485: =$cookie:CLASS.переменная2=<br>
2486:
2487: @response[]
2488: #^if($form:reload){
2489: $response:refresh[$.value[0] $.url[./t.html?uri=$env:SERVER_NAME]]
2490: #}
2491:
2492: @xslt[]
2493: ^xdata[]
2494: $transformed[^xdoc.transform[global.xsl;$.param1[123/]]]
2495: ^show_xdoc2[$transformed]
2496:
2497: @regexp2[]
2498: $s[ select]
2499: $s[^s.match[^^\s*][]{!}]
2500: $s
2501:
2502: @header[]
2503: $response:refresh[
2504: $.value[0]
2505: $.url[http://design.ru?a=^taint[123]]
2506: ]
2507:
2508: @ttablerem[]
2509: $table[^table::load[a.cfg]]
2510: ^table.menu{$table.a}
2511:
2512: @tconnect[]
2513: ^connect[mysql://test:test@paf/test?charset=cp1251_koi8&compress=1&timeout=1&named_pipe=1]{
2514: $tables[^table::sql{show tables}]
2515: #$cols[^tables.columns[]]
2516: #$cols.column
2517: ^tables.menu{
2518: $tables.[Tables_in_test]<br>
2519: }
2520: }
2521:
2522: @pcre[]
2523: $s[1 2]
2524: ^s.match[\s;ig]{!}
2525: #^s.match[\d;ig]{!}
2526:
2527:
2528: @regexp[]
2529: $s[abcАБВ]
2530: ^if(^s.match[б][i]){y}{n}
2531:
2532: @mail[]
2533: #$ORIGINS(1)
2534: ^mail:send[
2535: $.from[paf@design.ru]
2536: $.to[paf@design.ru]
2537: $.body[1
2538:
2539: 2
2540:
2541:
2542: 3]
2543: ]
2544:
2545: @fori[][i]
2546: ^for[i](1;3){... =$i= ...}
2547:
2548: @xdata0[]
2549: #$response:content-type[$.value[text/html] $.charset[windows-1251]]
2550: $xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
2551: <!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
2552: <people>
2553: <man id="1" имя="word слово">
2554: <name>P«^;AF B</name>
2555: </man>
2556: <man id="2">
2557: <name>ПИФ^taint[&]</name>
2558: </man>
2559: </people>
2560: }]
2561:
2562: @xdata[]
2563: #$response:content-type[$.value[text/html] $.charset[windows-1251]]
1.156 paf 2564: $xdoc[^xdoc::create{<?xml version="1.0" encoding="windows-1251"?>
1.15 paf 2565: <!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
2566: <people>
2567: <man id="1" имя="word слово">
2568: <name>P«^;AF B</name>
2569: </man>
2570: <man id="2">
2571: <name>ПИФ^taint[&]</name>
2572: </man>
2573: </people>
1.156 paf 2574: }]
1.15 paf 2575:
2576: @xml[]
2577: ^xdata[]
2578:
2579: ^show_xdoc2[$xdoc]<hr>
2580: #^show_xnode1[$xdoc]<hr>
2581: $people[^xdoc.select[*/man]]
2582: #^show1[]
2583: ^show_xnodes1[$people]<hr>
2584: #^people.0.owner.hren[]
2585:
2586: ^show_xnode1[^xdoc.selectSingle[*/man[2]/name];0;1]<hr>
2587:
2588: by id:
2589: ^show_xnode1[^xdoc.getElementById[1];0;1]
2590: <hr>
2591:
2592: @show1[array]
2593: ^for[i](0;^array._count[]-1){
2594: $x[$array.$i]
2595: $x.firstChild.nodeValue:
2596: $pattributes[$x.parentNode.attributes]
2597: ^if(^pattributes._count[]){
2598: $pattributes.id.name=$pattributes.id.nodeValue
2599: }
2600: <br>
2601: }
2602:
2603: @show_xnodes1[array][i]
2604: ^for[i](0;^array._count[]-1){
2605: ^show_xnode1[$array.$i;0;1]
2606: }
2607:
2608: @show_xnode1[x;level;single][l]
2609: ^if(def $x){
2610: ^for[l](0;$level-1){ ^; ^; ^; ^;}
2611: ^if($x.nodeType == $xnode:ELEMENT_NODE){
2612: <^;$x.nodeName
2613: $pairs[$x.attributes]
2614: ^if(def $pairs){
2615: $names[^pairs._keys[]]
2616: ^names.menu{ $names.key="$pairs.[$names.key].nodeValue"}
2617: }
2618: >^;
2619: }{
2620: [$x.nodeType]
2621: }
2622:
2623: ^if(def $x.nodeValue){$x.nodeValue}<br>
2624: ^show_xnode1[$x.firstChild]($level+1)
2625: ^if(!$single){
2626: ^show_xnode1[$x.nextSibling]($level)
2627: }
2628:
2629: ^if($x.nodeType == $xnode:ELEMENT_NODE){
2630: ^for[l](0;$level-1){ ^; ^; ^; ^;}<^;/$x.nodeName>^;<br>
2631: }
2632: }
2633:
2634: @show_xdoc2[xdoc]
2635: ^xdoc.save[out/save.xml;
2636: # $.encoding[utf-8]
2637: $.method[xml]
2638: ]
2639: $file[^xdoc.file[
2640: $.encoding[utf-8]
2641: $.method[html]
2642: ]]
2643: ^file.save[text;out/save_file.html]
2644: #$response:body[^xdoc.file[ $.media-type[text/paf] ]]
2645: <pre>^taint[html][^xdoc.string[
2646: $.method[html]
2647: # $.encoding[utF-8]
2648: # $.omit-xml-declaration[yes]
2649: # $.standalone[no]
2650: # -$.doctype-public[-//W3C//DTD XHTML]
2651: # -$.doctype-system[/a/b/c/]
2652: # $.indent[yes]
2653: # $.media-type[text/paf]
2654: ]]
2655: </pre>
E-mail: