File:  [parser3project] / parser3 / www / htdocs / Attic / index.html
Revision 1.166: download - view: text, annotated - select for diffs - revision graph
Tue Oct 15 15:37:12 2002 UTC (23 years, 9 months ago) by paf
Branches: MAIN
CVS tags: HEAD
^if(def $junction){was true}{now false}
use
^if($junction is junction){was and now true}

@USE
/derived.p
/operators.p

@auto[filespec]
$selffilespec[$filespec]
#$form:here
#$request:charset[UTF-8]
$request:charset[windows-1251]
$response:charset[windows-1251]
#$response:charset[UTF-8]
#$response:charset[empty]
#$response:content-type[$.value[text/html]$.charset[$response:charset]]

#@postprocess[body]
#<b>$body</b>
#$result[123]

@main[]
#$a(123)
#^a.format[%.10u]
#$result[111]
#^f[a]
#^connect[mysql://mdm:4b833ljq@db-mysql/mdm]{
#	^int:sql{select news_id from news where news_id=-1}[
#	$.default{2}
#	]<br>
#    ^hash::sql{bad}
#    ^string:sql{select news_id from news where news_id=-1}[$.default{2}]
#	^file::load[text;^string:sql{select 'from sql server' }]
#	^string:sql{select '^^hello[]' }] $ORIGINS(1)
#	^process{	^^h[]}
#	^process{^string:sql{select '1
#	^^hello[]' }]	}
#	^double:sql{select '2*' ^; }
#$card_sequence_expect_no(^double:sql{select 20020909131047 #card_sequence_expect_no from card_sequence})
#^card_sequence_expect_no.format[%15.f]
#}
#^eval(2)
#^tcrashlocaljunctionsv2[]
#^tcrashlocaljunctions[]
#^tjunctions[]
#^replacetest[]
#^matchoptionpp[]
#^txdocxnodechild[]
#^tclasses[]
#$math:PI
#^b:method[]
#^main[]
#^errort[]
#^tselectNumber[]
#$result[hello]
#^invaliddate2[]
#^process2[]
#^casehashtext[]
#^subjvaltest[]
#^tableselect0[]
#^memnotest1[]
#^voidparams[]
#^rolls2[]
#^cacheexpireschanging[]
#^cacheexpiresfixed[]
#^dateoffsets[]
#^exceptionTypes[]
#^roll2[]
#^rolls[]
#^exceptions1[]
#^locate_by_expr[]
#^method_junction_params{...}
#^verifyCookie[paf]
#^execlangs[]
#$t[^tobjeresult[]]$t.a
#^xmlprobs[]
#^doubleprobs[]
#^math:random(-10)
#^divnamestop[]
#^arrayclone[]
#^operator_tricks[]
#^xoutputrusattr[]
#^xdocset1[]
#^regexp3[]
#^exec2[]
#^tlock[]
#^xmloutattrwithoutvalue[]
#^precisionProblem[]
#^xpath[]
#^ttablesetlang[]
#^ttime[]
#^tupper[]
#^treplace[]
#^xslt2[]
#^tcache2[]
#$ORIGINS(1)
#$t[^table::set{a b} ^table::set{c d}]
#^ttaintuntaint[]
#^tappend2[]
#^badvsnprintf[]
#^badoracequoting[]
#^badconstructors[]
#^xloadwrongtable[]
#^xsetwrongtable[]
#^if($form:test){y}{n}
#^tablecolumnerror[]
#^roll[]
#^tableset[]
#^math:PI.format{%.30f}
#^xchildren[]
#^thashforeach3[]
#^thashforeach2[]
#^thashforeach[]
#^thashdelete[]
#^connect[mysql://user:pass@cd.rinet.ru/db]{^void:sql{z} }
#^tappend[]
#^sappend[]
#^eval(10\3)<br>
#^tform[]
#^formattest[]
#^filelist[]
#^connect[mysql://user:pass@host]{ }
#^безнадёжна_попытка_поправить_непоправимое[]
#^tcache[]
#^thashfileexp[]
#^tcounter[]
#^tablehash[]
#j^hashfile[]
#^formclass[]
#^hren[]
#^domedit[]
#^domxslt[]
#^lsplit2[]
#^faceesize[]
#^imageresize[]
#^ifassignhash[]
#^tintdefault[]
#$response:status[404]
#^ifpasshash[]
#^movedir[]
#^replace[]
#^set[]
#^hash[]<hr>
#$t[^methresult[]] ->$t
#^terror[]
#^ssave[]
#^thash[]
#^tdef[]
#^ford[]
#^tif[]
#^image[]
#^response[]
#^regexp2[]
#^ttablerem[]
#^pcre[]
#^regexp[]<hr>
#^mail[]
#^fori[]
#^tconnect[]
#^xslt[]
#^header[]
#^tablehasht[]
#^datecreatestring[]
#^mssqltypes1[]
#^badthrows[]
#^xmlspace[]
#^counter[main.counter]
#^xpath2[]
#^callindirect[]
#^junctionprob[]
#^datecreatestring2[]
#^tstoredproc[]
#^tstoredproc2[]
#^forkeys[]
#^pngsize[]
#^checkList[]
#^datetest[]
#^tserge[]
#^envt[]
#^selectt[]
#^select2[]
#^selectSingle2[]
#^selectString2[]
#^selectNumber2[]
#^selectBool2[]
#^xdoccreate[]
#^xdoccreatetag[]
#^xdocload[]
#^xdocstring[]
#^xdocsave[]
#^div[]
#^datecreatestring3[]
#^tfilespec[]
#^tcrypt[]
#^cryptdocsample[]
#^tnormalize[]
#^xmltransformbyxdoc[]
#^sergestrandef[]
#^tstdin[]
#^tfind[]
#^mimet[]
#^joinlimit[]
#^tableclonelimit[]
#^transparams[]
#^sendtests[]
#^wwrapperpass[]
#^badpos[]
#^processtest[]
#^mail3[]
#^datesaving[]
#^badconstructor[]
#^calendar[]
#^monthdays(8)
#^xdoctypetest[]
#^xtabletest[]
#^staticstest[]
#^staticstest2[]
#^rbodytest[]
#^cookie[]
#^cookieexpirestest[]
#^postest[]
#^voidpostest[]
#^badcolumntest[]
#^delimiters[]
#^новый-split[]
#^грязные-cookie[]
#^html-почта[]
#^badswitchtest[]
#^okswitchtest[]
#^cgit[]
#^ttransformsep[]
#^calltest[]
#^xpath3[]
#^doubleliterals[]
#^newxor[]
#^mail2[]
#^exec[]
#^passpost[]
#^fordelim[]
#^duplicatetable2hashkey[]
#^duplicatehashsqlkey[]
#^longlreplace[]
#^table2hash_onecolumn[]
#^crossopvars[]
#^three[]
#^badLangAfterCatch[]
#^zeroinstdin[]
#^shifts[]
#^jspace[]
#^hashselfmodification[]
#^emptyTransformResult[]
#^badxdoccreate[]
#^if(-d "CVS"){y}{n}
#^badjunctioncall[]
#^russianindex[]
#^virtualtest[]
#^xml[]
#^mail4[]
#^voidconstructorpass[]
#^$form:CLASS.a=$form:CLASS.a<br>
#^cookie2[]
#^menudelim[]
#^touchittest[]
#^touchittest2[]
#^opauto[]
#^trycontextt[]
#^tfor[]
#^user-foreach-test[]
#^includet[]
#^derived:includet[]
#^fortestsep[]
#^derived:inclass_process_test[]
#$derived[^derived::create[]]^derived.inclass_process_test[]
#^domorigint[]
^junctiontest2[]

@junctiontest2[]
^if($if is junction){is junction;not junction}<br>
^if(def $if){defined;not defined}<br>

@domorigint[]
$xdoc[^xdoc::create[вася]]
^xdoc.firstChild.setAttribute[name;значение]
$var[$xdoc.firstChild.nodeName]
^throw[paf;$var]


@fortestsep[][i]
^for[i](1;3){$i}[,]

@includet[]
^include[some.p]
^included_method[2]

@user-foreach-test[][key;value]
^user-foreach[key;value]{$key=$value<br>}

@user-foreach[key;value;code]
^for[i](1;10){
	$caller.$key($i)
	$caller.$value($i*2)
	$code
}


@tfor[][i]
^for[i](1;10){
$i
}

@trycontextt[]
^try{
	^trycontexttsub[]
}{
	$exception.handled(0)
}


@trycontexttsub[]
^bad[]


@opauto[]
^reada[]


@rusage2[]
<hr>
OK

@rusage2[]
$s[$status:rusage]

^s.tv_sec.format[%.0f].^s.tv_usec.format[%06.0f]


@voidconstructorpass[]
$a[$form:a]
=^form:a.int(1)=
=^a.int(1)=


@russianindex[]
#dir with files with russian-lang names
$where[dir]

$dir[^file:list[$where;\.txt^$]]
^dir.menu{
	<a href=$where/^untaint[uri]{$dir.name}>$dir.name</a><br>
}

@badjunctioncall[]
^badjunctioncallinside{code}

@badjunctioncallinside[code]
xx^code[]

@badxdoccreate[]
$xdoc[^xdoc::create[вася]]
#$xdoc[^xdoc::create{<?xml version="1.0" encoding="$request:charset"?><doc>вася</doc>}]

^xdoc.firstChild.setAttribute[name;значение]
^xdoc.string[]


@emptyTransformResult[]
$input[^xdoc::create[docBad]]
$sheet[^xdoc::create{<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:template match="doc">
		output
	</xsl:template>
</xsl:stylesheet>
}]
$output[^input.transform[$sheet]]
$response:body[^output.file[]]

@hashselfmodification[]
$hash[
	$.a[1]
	$.b[2]
]
^hash.foreach[key;value]{
#	$hash.c[1]
	$hash.a[1]
}	

@touchittest[][i]
$i[before]
^touchit[]
$i

@touchittest2[]
$i[before]
^touchit[]
$i


@jspace[]
$a(1)
^jspace_call{^eval($a*2)}
#$a(2)
#$junction

@jspace_call[param][a]
$a[unrelcfgdfgated]
$junction<br>
$junction.a(2)
$junction<br>

@shifts[]
^eval(1<<3)<br>
^eval(8>>2)<br>
#^if(1=1){y;n}<br>


@zeroinstdin[]
#$f[^file::exec[a.pl;$.stdin[$.shit[]]]]
$f[^file::exec[a.pl;$.stdin[^file::load[binary;1z2.txt]]]]
=$f.text=
^f.save[binary;1z2.out]

@badLangAfterCatch[]
^try{
	$a[ 
		тут язык сменился на pass_appended
		^throw[user;test]
		и улетело с не тем  языком
	]
}{
	$exception.handled(1)
}
1  2

@crossopvars[]
#^one[]<hr>
^two[]<hr>

@table2hash_onecolumn[]
$t[^table::create{a
1
1
}]
#^t.hash[a]
#^t.hash[a;b]
$h[^t.hash[a][$.distinct(1)]]
$h.1.a

@longlreplace[]
$str1[  мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла мыла ]
$str2[ела]
$str[Мама $str1 раму]

^str.replace[^table::create[nameless]{мыла	$str2}]

@duplicatehashsqlkey[]
^connect[mysql://mdm:4b833ljq@db-mysql/mdm]{
	$t[^table::sql{select * from news}]
	$c[^t.columns[]]
	^c.menu{$c.column}[,]

	$h[^hash::sql{select news_type_id, name from news}[$.distinct(1)]]
}

@duplicatetable2hashkey[]
$t[^table::create{a	b
1	2
1	3
}]
#^t.hash[a]
#^t.hash[a;b]
^t.hash[a][$.distinct[1]]

@menudelim[]
$t[^table::create{a
1
2
3
4
5
}]

^t.menu{^if($t.a<3){}{$t.a}}[,]

@fordelim[]
^for[a](0;6){^if($a<3){}{$a}}[,]


@passpost[]
<form method=post name="test" id="test">
<textarea name="text" cols=20 rows =6>^taint[html][1
2

3]</textarea><br>
<input type=submit>
</form>

^if(def $form:text){
	$a[^file::cgi[a.pl]]
	$a.text|$a.status|$a.stderr<hr>
}

@exec[]
#$a[^file::exec[a.cmd]]
$a[^file::cgi[a.cmd]]
$a.text|$a.status|$a.stderr<hr>


@newxor[]
^eval(1!|2 #примечание()zzz
|0x100)<br>
#^eval(1!||2)<br>
^if(1!|1){y}{n}

#@method[$bad]

@doubleliterals[]
#^eval(1e-10)
^eval("1e-20")

@xpath3[]
$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>}]
$objectData[^constr.selectSingle[/constructor-data/object]]
$objectData.nodeType<br>
$objectData.firstChild.nodeValue

@calltest[]
^calltest2[string]

@calltest2[s]
$s

@ttransformsep[]
$input[^xdoc::load[20020909131046.xml]]
$output[^input.transform[generated.xsl]]
^output.string[]

@okswitchtest[]
$local[local value]
^switch[1]{
	^case[1]{1code $local}
}

@badswitchtest[]
^switch[1]{
	^badswitchtestcase[]
}
@badswitchtestcase[][local]
$local[local value]
	^case[1]{1code $local}

@badjunction[]
^badj1[]
^badj2[]

@html-почта[]
$переменная[значение]
^mail:send[
	$.from[paf@mail]
	$.to[paf@mail]
	$.subject[htmltest1]
	$.html{тест$переменная=  !}
]

                 
@грязные-cookie[]
$cookie:a[&]
$cookie:a

@новый-split[]
$abc[a.b.c]
#$table[^abc.split[.]]
#$table[^abc.split[.;l]]
#$table[^abc.split[.;v]]
$table[^abc.split[.;lv]]
^table.menu{$table.piece}[,]
<hr>
#$table[^abc.split[.;h]]
$table[^abc.split[.;hr]]
$table.0,$table.1,$table.2<br>

@delimiters[]
$a#1[1]<br>
$a#1=<br>


@badcolumntest[]
$table[^table::load[ext.cfg]]
$table.b


@virtualtest[]
$derived[^derived::create[derived create actual param]]
^derived.test[]


@voidpostest[]
$s[]
^s.pos[$nothing]

@postest[]
$s[$nothing]
^s.pos[$nothing]

@cookieexpirestest[]
#$cookie:exptest[1]
#$cookie:exptest[$.value[2] $.expires(+1)]
$response:xxxx[^date::now(+10)]
$response:yyy[$.value[^date::now(+20)]]
$response:yyy[$.value[vvv] $.aaaa[^date::now(+20)]]

@rbodytest[]
$request:body=
<form method=post>
<input type=submit name=paf value=123>
</form>

@staticstest2[]
^$derived:derived_var=$derived:derived_var<br>
^$derived:a=$derived:a<br>
$derived:a[changed] ^$derived:a=$derived:a<br>
$derived:derived_var[changed] 
^$derived:derived_var=$derived:derived_var<br>

@staticstest[]
$derived[^derived::create[]]
^derived.test[]
<hr>
^$derived.a=$derived.a<br>
^$derived.x=$derived.x<br>
<hr>
^if($derived is derived){derived is derived}{error: derived is not derived}<br>
^if($derived is table){derived is table}{error:derived is not table}<br>
<hr>
^^eval(^$derived)=^eval($derived)<br>
^^if(^$derived)=^if($derived){y}{n}<br>


@xdoctypetest[]
$xdoc[^xdoc::create[x]]
^if($xdoc is xdoc){y}{n}

@xtabletest[]
$xtableo[^xtable::create[]]
^if($xtableo is table){y}{n}
#^xtableo.columns[]

@monthdays[month]
$from[^date::create(2000;$month;1)]
$to[^date::create($from)] ^to.roll[month](+1)
$result($to-$from)

@badconstructor[]
^date::now[]

@datesaving[]
$now[^date::now[]]
$now.daylightsaving<br>
$now.yearday<br>
#
$date[^date::create(2002;1;3)]
$date.daylightsaving<br>
$date.yearday

@mail4[]
^mail:send[
	$.from[paf@mail.design.ru]
	$.to[paf@mail.design.ru]
	$.subject[^taint[uri][москва=E0_+ ]=2]
	$.text[^taint[uri][москва]=]
	$.html{<a href=http://there.ru/?city=^taint[uri][Москва]>link</a>}
]
@processtest[]
    $f[^file::load[text;piece.p]]	^process{$f.text}
	$ORIGINS(1)


@badpos[]
$s[123]
^s.mid(0;2)

@wwrapperpass[]
$h[^hash::create[]]
$h.a(1)
^my_method[^if(1){$h}]
работает. так и должно быть?

@my_method[p]
^p._count[]


@tableclonelimit[]
$source[^table::create{a
aa
bb
cc}]
^source.offset(1)
#$dest[^table::create[$source]]
$dest[^table::create[$source;$.offset(2)]]
$dest[^table::create[$source;$.limit(2)]]
$dest[^table::create[$source;$.offset(1)$.limit(1)]]
$dest[^table::create[$source;$.offset(1)$.limit(2)]]
$dest[^table::create[$source;$.offset[cur]$.limit(2)]]

^dest.menu{$dest.a}[,]<br>

@joinlimit[]
$source[^table::create{a
aa
bb
cc}]
^source.offset(2)
$dest[^table::create{a
xx
}]
#^dest.join[$source]
#^dest.join[$source;$.offset(2)]
#^dest.join[$source;$.limit(2)]
#^dest.join[$source;$.offset(1)$.limit(1)]
#^dest.join[$source;$.offset(1)$.limit(2)]
#^dest.join[$source;$.offset[cur]$.limit(1)]
^dest.join[$source;$.limit(0)]

^dest.menu{$dest.a}[,]<br>

@cgit[]
$f[^file::cgi[showenv.cmd]]
$f.HELLO=<br>
$f.CONTENT-TYPE=<br>
$f.content-type=<br>


@mimet[]
$f[^file::stat[a.GIF]]
$f.content-type


@tfind[]
^file:find[index.html]

@tstdin[]
$f[^file::exec[test.pl;$.stdin[проверка stdin потока]]]
<pre>$f.text</pre>

@sergestrandef[]
$sQuantity[ ]
^sQuantity.int(10)

@xmltransformbyxdoc[]
$xdoc[^xdoc::set{^process{<?xml version="1.0" encoding="windows-1251"?>
<!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
<people>
	<man id="1" имя="word слово">
		<name>1  2</name>
	</man>
</people>
}}]
$sheet[^xdoc::create{<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"

>
<!--<xsl:output doctype-public ="-//W3C//DTD XHTML" indent="yes"/>-->

	<!--<xsl:import href="http://localhost/html.xsl"/>-->
	<xsl:import href="html.xsl"/>

<xsl:param name="param1">defparam1</xsl:param>
<xsl:param name="param2">defparam2</xsl:param>


	<xsl:template match="doc">
		param1=<xsl:value-of select="^$param1"/><br/>
		param2=<xsl:value-of select="^$param2"/><br/>

		test return <something background=""/>
	</xsl:template>

	<xsl:template name="test">
		test return3
	</xsl:template>

  <xsl:template match="people">
     <html>
     <head>
<link type='text/xml' rel='alternate' href='/Default.vsdisco'/>
z</head>
   		para1=<xsl:copy-of select="^$param1"/>
    	<xsl:apply-templates/>
    	<hr/>
    	<xsl:call-template name="test"/>
     </html>	
  </xsl:template>

  <xsl:template match="name">
    <b><xsl:value-of select="."/></b>
  </xsl:template>
</xsl:stylesheet>
}]


$xdoc[^xdoc.transform[$sheet]]
$string[^xdoc.string[$.method[html]]]
^string.save[a]
^untaint[html]{$string}



@tnormalize[]
#s состоит из 1000 фрагментов
$s[^for[i](0;999){фрагмент }]
#это займет много ресурсов
^s.match[фраг][g]{перга}
#это займет меньше ресурсов
#$normalized[^s.normalize[]]
#^normalized.match[фраг][g]{перга}

@sendtests[]
^text[]
#^html[]
#^text-n-html[]
#^file[]
#^text-n-file[]
#^text-n-html-n-file[]
#^backwardcomp[]

@backwardcomp[]
^mail:send[
	$.from[paf]
	$.to[paf]
	$.body[this is text value]
]

@text[]
^mail:send[
	$.from[paf]
	$.to[paf]
	$.text[
		$.value[this is text value]
	]
]

@html[]
^mail:send[
	$.from[paf]
	$.to[paf]
	$.html{this is <b>html</b> value ^taint[<] 10}
]

@text-n-html[]
^mail:send[
	$.from[paf]
	$.to[paf]
	$.text[
		$.value[this is text value]
	]
	$.html[
	$.value{this is <b>html</b> value ^taint[<] 10}
	]
]

@file[]
^mail:send[
	$.from[paf]
	$.to[paf]
	$.file[^file::load[binary;image.jpg]]
]

@text-n-file[]
^mail:send[
	$.from[paf]
	$.to[paf]
	$.text[
		$.value[this is text value]
	]
	$.file[^file::load[binary;image.jpg]]
]

@text-n-html-n-file[]
^mail:send[
	$.from[paf]
	$.to[paf]
	$.text[
		$.value[this is text value]
	]
	$.html[
	$.COntent-type[$.value[text/html]$.charset[windows-1251xx]]
	$.value{this is <b>html</b> value ^taint[<] 10}
	]
	$.file[^file::load[binary;image.jpg]]
]



@md5salt[]
1234

@cryptdocsample[]
$users[^table::create{name	password
alice	***
bob	***
}]

$htpasswd[^table::create[nameless]{}]
^users.menu{
	^htpasswd.append{$users.name:^math:crypt[$users.password;^$apr1^$^md5salt[]]}
}

^htpasswd.save[nameless;.htpasswd-parser-test]


@tcrypt[]
#^math:crypt[123;^$apr1^$1234567890abcdef]<br>
^math:crypt[123;^$apr1^$]<br>

@tfilespec[]
src=$selffilespec<br>
dirname=^file:dirname[$selffilespec]<br>
basename=^file:basename[$selffilespec]<br>
justname=^file:justname[$selffilespec]<br>
justext=^file:justext[$selffilespec]<br>

@datecreatestring3[]
$new_after[^date::now(-3)]
$articles[^table::create{id	title	last_update
1	привет	2002-07-03}]
^articles.menu{
    $last_update[^date::create[$articles.last_update]]
    <a href=${articles.id}.html>$articles.title</a>
    ^if($last_update > $new_after){новая}
    <br>
}

@div[]
$var(5)
^var.inc(7)
^var.dec(3)
^var.div(4)
^var.mul(2)
$var


@xdocsave[]
$document[^xdoc::create{<?xml version="1.0" encoding="windows-1251" ?>
<document>
строка1<br/>
строка2<br/>
</document>}]
^document.save[test.xml]

@xdocstring[]
$document[^xdoc::create{<?xml version="1.0" encoding="windows-1251" ?>
<document>
строка1<br/>
строка2<br/>
</document>}]
^document.string[
    $.method[html]
]


@xdocload[]
$document[^xdoc::load[article.xml]]
$response:body[^document.file[$.media-type[text/xml]]]


@xdoccreatetag[]
$document[^xdoc::create[document]]
$paraNode[^document.createElement[para]]
$dummy[^document.documentElement.appendChild[$paraNode]]
$response:body[^document.file[$.media-type[text/xml]]]


@xdoccreate[]
$document[^xdoc::create{<?xml version="1.0" encoding="windows-1251" ?>
<document>
текст
</document>}]
$response:body[^document.file[$.media-type[text/xml]]]

@selectBool2[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
<t attr="привет" n="123"/>}]
^if(^d.selectBool[/t/@n > 10]){
    /t/@n больше 10
}{
    не больше
}


@selectNumber2[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
<t attr="привет" n="123"/>}]
^d.selectNumber[number(/t/@n)+1]<br>
^d.selectNumber[2*2]<br>


@selectString2[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
<t attr="привет" n="123"/>}]
# результат=привет
^d.selectString[string(t/@attr)]


@selectSingle2[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
<t attr="привет" n="123"/>}]
# результат=один элемент "t"
$element[^d.selectSingle[t]]
# результат=2 (количество атрибутов <t>)
Количество атрибутов: ^element.attributes._count[]<br>
# результат=не существует (нет <x>)
^if(^d.select[x]){
    x существует
}{
    x не существует
}

@select2[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><t attr="привет" n="123"/>}]
# результат: список из одного элемента "t"
$list[^d.select[t]]
# результат: 2 = количество атрибутов <t>
^list.0.attributes._count[]<br>
^for[i](0;$list-1){
    $attr[$list.$i]
    $attr.nodeName = $attr.nodeType<br>
}


@selectt[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><t attr="привет" n="123"/>}]
$list[^d.select[t]]
^list.0.attributes._count[]

@envt[]
$f[^file::exec[showenv.cmd;
	$.bad[value]
	$.CGI_good[value]
]]
$f.status<br>
$f.stderr<br>
<pre>$f.text</pre>


@tserge[]
^if(" 09 "){y}

@datetest[]
	$f[^file::stat[some.zip]]
Размер в байтах: $f.size<br>
Год создания: $f.cdate.year<br>
$now[^date::now[]]
$DAYS_CONSIDERED_NEW(3)
Статус: ^if($f.mdate >= $now-$DAYS_CONSIDERED_NEW){новый;старый}


@checkList[]
...^oneOf[a;a,b,c]...<br>
#...^oneOf[a;ax,b,c]...<br>
...^oneWord[word]...<br>
#...^oneWord[wo rd]...<br>


@oneOf[s;list][t] выдаёт строку, если строка она есть в списке(разделенном запятыми)
$t[^list.lsplit[,]]
^if(!^t.locate[piece;$s]){^throw[user;$s;unknown]}
$result[$s]

@oneWord[s]
^if(^s.match[\W]){^throw[user.data;$s;not word]}{$s}

@pngsize[]
$i[^image::measure[test.png]]
^i.html[]


@forkeys[]
$text[^form:fields.foreach[key;val]{$key=$val
}]
^text.save[ttt.txt]
=$text=


@tstoredproc2[]
^connect[odbc://DSN=nestle^;UID=nestle^;PWD=mbm32]{
	^void:sql{exec pafvoid}
}

@tstoredproc[]
^connect[odbc://DSN=nestle^;UID=nestle^;PWD=mbm32]{
	$t[^table::sql{exec pafproc}]
#	$t[^table::sql{{call pafproc}}]
	$c[^t.columns[]]
	^c.menu{$c.column}[<br>]
}

@datecreatestring2[]
<table border=1>
^datecreatestring2show[2000]
^datecreatestring2show[2000-02]
^datecreatestring2show[2000-2-03]
^datecreatestring2show[2000-02-03 15]
^datecreatestring2show[2000-02-03 15:30] 
^datecreatestring2show[2000-02-03 15:30:04] 
^datecreatestring2show[2000-02-03 15:30:04 hren] 
^datecreatestring2show[15:30] 
^datecreatestring2show[15:30:05] 
^datecreatestring2show[15:30:05 hren] 
</table>

@datecreatestring2show[s]
$date[^date::create[$s]]
<tr>
<td>$s</td><td align=right>^date.sql-string[]</td>
</tr>


@junctionprob[][l]
$l[123]
$a{$l}
^junctionprobnested[$a]
@junctionprobnested[p]
$p


@callindirecttarget[]
callindirecttarget called
@callindirect[]
$f[$callindirecttarget]
^f[]

@xpath2[]
$xdoc[^xdoc::create{<?xml version="1.0" encoding="windows-1251"?>
<doc>
<field-list>
<field name="aa"/>
<field name="bb"/>
</field-list>
</doc>
}]

#^xdoc.string[]

$fieldList[^xdoc.selectSingle[/doc/field-list]]
#^fieldList.childNodes._count[]
$fields[^fieldList.select[field]]
#^fields._count[]
^fields.foreach[k;node]{
	$node.nodeName<br>
}
@counter[filespec][f;s]
^file:lock[$filespec]{
	$f[^file::load[text;$filespec]]
	$s[^eval($f.text+1)]
	^s.save[$filespec]	
}
$s

@xmlspace[]
$xdoc[^xdoc::set{^process{<?xml version="1.0" encoding="windows-1251"?>
<!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
<people>
	<man id="1" имя="word слово">
		<name>1  2</name>
	</man>
</people>
}}]
$xdoc[^xdoc.transform[global.xsl]]
$string[^xdoc.string[$.method[html]]]
^string.save[a]
^untaint[html]{$string}

@badthrows[]
#^throw[a;b;]
^throw[a;]

@mssqltypes1[]
^connect[odbc://DSN=nestle^;UID=nestle^;PWD=mbm32]{
#    ^string:sql{select { ts '1998-05-02 01:23:56.123' }}
#    ^string:sql{select CAST({ ts '1998-05-02 01:23:56.123' }AS smalldatetime)}
#	^string:sql{select CAST({ts '2002-04-28 00:00:00.000'} AS smalldatetime)}
	$t[^table::sql{select a from paf}]
	^t.count[]
}

@datecreatestring[]
$d[^date::create[2002-04-33 01:03:04]]
^d.sql-string[]

@method[hash]
$hash.key
@mainZ[]
^method[
    $.key{code}
]

@tablehasht[]
$t[^table::create{p
1
3
2
4}]

$h[^t.hash[p]]

=^h._count[]=


@sqldefaults[]
^connect[mysql://mdm:4b833ljq@db-mysql/mdm]{
	^int:sql{select news_id from news where news_id=-1}[$.default{2}]<br>
    ^string:sql{select news_id from news where news_id=-1}[$.default{2}]
}
=======
<hr>
OK
>>>>>>> 1.50

@tcrashlocaljunctionsv2[]
$a[
	$b{  $c[1] }
]
$b
$c

@tcrashlocaljunctions[]
$var[aaa]
^if(1){
^tcrashlocaljunctions1[]
}

$j

@tcrashlocaljunctions1[][var]
$var[varvalue]
	$j{
		$var
	}
$j

@tjunctions[][tl]
$t[^t::create[]]
^tjunctionsi[]

@tjunctionsi[][tl]
$tl[12345]
^t.tjunctionsm[
	$.key{
		$tl
	}
]

@replacetest[]
$b[b]
$s[
aaaaaaaaaa${b}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa${b}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
]
^s.replace[^table::create{from	to
ba	!_}]


@matchoptionpp[]
#$ORIGINS(1)
$s[
aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
]
^s.match[b;g']{($match.prematch|$match.match|$match.postmatch)}


@txdocxnodechild[]
$xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?><d/>}]
$xdoc.nodeName
^xdoc.selectNumber[2*2]
$xdoc:ELEMENT_NODE


@tclasses[]
$t[^t::create[]]
^t.method[]
<hr>
^t.base_method[]


@errort[]
^xdoc::create[a]
#^throw[user;here;this]

@tselectNumber[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><d attr="привет" n="123"/>}]
^d.selectString[string(d/@attr)]<br>
^d.selectNumber[2*2]<br>
^d.selectNumber[number(/d/@n)+1]<br>


@invaliddate2[]
$d[^date::create(1018946575/60/60)] ^d.sql-string[]

@process2[]
^^process{
	^process{
		^$a[^^if(0){^$.k[y]}{^$.k[^^hren[]n]}] ^$a.k
	}
}

@casehashtext[]
$tt[1]
$tmp[
        ^switch[$tt]{
                ^case[1]{
                        $.aaa[123]
                }
                ^case[DEFAULT]{
                        $.bbb[456]
                }
        }
        shit!
]
#$tmp
$tmp.aaa

@subjvaltest[]
$a12[val]
$b[12]
$a$b

@tableselect0[]
$person[^table::create{name	height
paf	1.77
шохин	2.07
moko	1.77
}]
$nottoohigh[^person.select($person.height<2)]
^nottoohigh.menu{$nottoohigh.name<br>}

@transparams[]
$idoc[^xdoc::create{<?xml version="1.0" ?><doc/>}]
$odoc[^idoc.transform[global.xsl;
	$.param1['1']
	$.param2['2']
]]
<pre>^taint[^odoc.string[$.method[html]]]

@memnotest1[]
^for[i](0;4000){

 $xxxx[$i]
 $xxxx

}

@memnotest1notes[]
одна итерация цикла:
[Mon Apr  8 20:12:02 2002] execution-------------------------|
'469641+=28 wcodeframe -> 0 !optimize[3]''469669+=49 string от {} -> 0 optimize[3]'
[Mon Apr  8 20:12:02 2002] 12:STRING__WRITE
[Mon Apr  8 20:12:02 2002]  "|| "
[Mon Apr  8 20:12:02 2002] 12:WITH_ROOT
[Mon Apr  8 20:12:02 2002] 13:VALUE
[Mon Apr  8 20:12:02 2002]  "xxxx" string
[Mon Apr  8 20:12:02 2002] 14:CREATE_EWPOOL'469377+=24 wcodeframe -> 0 !optimize[1]''469401+=49 string -> 41 !optimize[7]'
[Mon Apr  8 20:12:02 2002] 16:WITH_READ
[Mon Apr  8 20:12:02 2002] 17:VALUE
[Mon Apr  8 20:12:02 2002]  "i" string
[Mon Apr  8 20:12:02 2002] 18:GET_ELEMENT
[Mon Apr  8 20:12:02 2002] 17:WRITE_VALUE'469452+=40 MAX_NUMBER -> !~2 actual digits''469492+=49 -> 41 !'
[Mon Apr  8 20:12:02 2002] 16:REDUCE_EWPOOL'469541+=24 VString -> 0 optimize[5]'
[Mon Apr  8 20:12:02 2002] 15:CONSTRUCT_VALUE
[Mon Apr  8 20:12:02 2002] 12:STRING__WRITE
[Mon Apr  8 20:12:02 2002]  "| "
[Mon Apr  8 20:12:02 2002] 12:WITH_READ
[Mon Apr  8 20:12:02 2002] 13:VALUE
[Mon Apr  8 20:12:02 2002]  "xxxx" string
[Mon Apr  8 20:12:02 2002] 14:GET_ELEMENT
[Mon Apr  8 20:12:02 2002] 13:WRITE_VALUE'469573+=41 string expand nothing for now'
[Mon Apr  8 20:12:02 2002] 12:STRING__WRITE
[Mon Apr  8 20:12:02 2002]  "||"'469617+=24 VString -> 0 !optimize[6]'
[Mon Apr  8 20:12:02 2002] <-ja returned
[Mon Apr  8 20:12:02 2002] ja->

201/328=0.612804878049 %%optimized

1.
CREATE_*POOL
    сделать
*POOL_POOLED+CODE
    где
        wwrapper
        и(возможно) wcodeframe
        +string
        стековая переменная

2.
избавиться от обёртки при возврате результата process [см. тело _for]

3.
сделать callback для process, чтобы вынести invariants из _for & co.

4.
 @todo склеить get_element и write_value (при вставлении? write_value)

5.
reduce_*pool -> вариант получить именно string, без VString обёртки [часто
обёртка сразу выбрасывается = не нужна]

6.
process вариант получить именно string, без VString обёртки [часто обёртка
сразу выбрасывается = не нужна]

7.
string head, убить 8 байт неправильной link

@voidparams[]
^voidparamsm[$form:field]

@voidparamsm[p]
^p.int(123)

@rolls2[]
$now[^date::now[]]
$d[^date::create($now.year;$now.month)] ^d.sql-string[]<br>
^for[i](1;12){
	^d.roll[month](-1) ^d.sql-string[]<br>
}

@cacheexpireschanging[]
^cache[$DB_HOME/keyключ][^date::now(+1)]{ ^rem{1 day}
    ^cache[^date::now(+4/24/60/60)]
#    ^cache(2)
#    ^cache(0)
	^math:random(100)
}



@cacheexpiresfixed[]
^cache[$DB_HOME/keyключ][^date::now(+2/24/60/60)]{
	^math:random(100)
}

@dateoffsets[]
$d[^date::create(^date::now[]+1/24/60)]
#$d[^date::now(+1/24/60)]
^d.sql-string[]
#$d

@exceptionTypes[]
#    parser.compile       ^test[}                компиляция (непарная скобка, ...)
#    parser.runtime       ^if(0).                параметры (больше/меньше, чем нужно, не тех типов, ...)
#    number.zerodivision  ^eval(1/0) ^eval(1%0)
#    number.format        ^eval(abc*5)
#    file.missing         ^file:delete[delme]                       not found
#    file.access          ^table::load[.]                       no rights
#    image.format         ^image::measure[index.html]                        not gif/jpg
#    sql.connect          ^connect[mysql://baduser:pass@host/db]{}                       not found/timeout
#    sql.execute          ^connect[mysql://okuser:pass@host/db]{^void:sql{select bad}}                       syntax error
#    xml                  ^xdoc::create{<forgot?>}                       any error in xml/xslt libs
#    smtp.connect                                not found/timeout
#    smtp.execute                                communication error

@roll2[]
$d[^date::create(2002;4;2;2;2;3)] ^d.sql-string[]<br>
^d.roll[day](+365*3+1) ^d.sql-string[]<br>


@rolls[]
$d[^date::create(2002;4;4)]
^d.sql-string[]<br>
^for[i](1;7){
^d.roll[day](-1)
^d.sql-string[]<br>
}
<hr>
$d[^date::create(2002;3;28)]
^d.sql-string[]<br>
^for[i](1;7){
^d.roll[day](+1)
^d.sql-string[]<br>
}
<hr>
$d[^date::create(2002;12;3)]
^d.sql-string[]<br>
^for[i](1;14){
^d.roll[day](-1)
^d.sql-string[]<br>
}
<hr>
$d[^date::create(2002;10;19)]
^d.sql-string[]<br>
^for[i](1;14){
^d.roll[day](+1)
^d.sql-string[]<br>
}






@exceptions1[]
^try{
	aaa
	^throw[custom1;paf;is stupid]
}{
	^if($exception.type eq custom1){
#		$exception.handled(1)
	^throw[$exception]
		type=$exception.type<br>
	    source=$exception.source<br>
	    file=$exception.file<br>
	    lineno=$exception.lineno<br>
    	comment=$exception.comment<br>
	}
}

@locate_by_expr[]
$t[^table::create{a	b
1	nok
2	ok
3	nok
}]
^if(^t.locate($t.a==2)){$t.b}{n}

@method_junction_params[param]
^if($param is junction){junction}{ne junction}

@verifyCookie[value] 
^if($cookie:dummyvote eq $value){ 
	$result(1) 
}{ 
	$cookie:dummyvote[$value] 
	$result(0) 
}

@execlangs[]
$f[^file::exec[test.pl]]
err:$f.stderr<br>
^process{$f.text}
#$c[^t.columns[]]
#^c.menu{
#* $c.column<br>
#}
c:$t.c<br>

@tobjeresult[]
^table::create{a
12}

@xmlprobs[]
$xmlDataType[^xdoc::load[program.xml]]
#<pre>^taint[^xmlDataType.string[]]
$xmlDataTypes[^xmlDataType.select[programs/program[@id=4]/data]]
#=^xmlDataTypes._count[]=
=^xmlDataTypes.0.getAttribute[type-id]=

@doubleprobs[]
$1(^math:radians(180))
$2($math:PI)
^if(^1.format[%.10f]==^2.format[%.10f]){y;n}
^if($1==$2){y;n}
^if(^math:radians(180)==$math:PI){y;n}


@divnamestop[]
$a(10)
^eval($a\3)

@arrayclone[]
$t[^table::create{a	b
1	11
2	22
}]
$c[^table::create[$t]]
^c.append{2	33}
^t.count[]
^c.count[]

@operator_tricks[]
^if(1){$a[^t[]]}
$a!
$a($b)
^if(1){y}{n}
$MAIN:a(^t[] eq OK)
#$MAIN:a(1)
^if($a){y}{n}
#^if(1){y}{n}
$form:if
$a[$.n[1]]
$a.if

@xoutputrusattr[]
$d[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?><d attr="привет"/>}]
^show_xdoc2[$d]

@xdocset1[]
$d[^xdoc::set{<?xml version="1.0"?><d>=^taint[&]=</d>}]
^show_xdoc2[$d]

@regexp3[]
$s[abcАБВ]
^if(^s.match[][i]){y}{n}


@exec2[]
$a[^file::exec[bin/t.cmd]]
<pre>^taint[$a.text]</pre>|$a.status|$a.stderr<hr>


@tlock[]
^file:lock[lockfile]{
	code
}

@xmloutattrwithoutvalue[]
#$ORIGINS(1)
$doc[^xdoc::set{<?xml version="1.0"?><doc background="">zz</doc>}]
$doc[^doc.transform[global.xsl]]
=^taint[html][^doc.string[$.method[html]]]=



@precisionProblem[]
$a[123456789012345678901234567890]
$b(^a.double[])
^b.format{%.20E}
<hr>
^eval(2*2)

@xpath[]
$xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?>
<document><block><p>привет</p></block></document>
}]
#^show_xdoc2[$xdoc]
$node[^xdoc.selectSingle[/document/block/p]]
^if(def $node){
	^if($node is string){
		$node
	}{
    	^if($node is hash){
    		^node._count[]
    	}{
    		$node.nodeType
    	}
	}
#$node.firstChild.nodeValue
}{
	node not found
}


@ttablesetlang[]
$a-tab-b[a	b
1	2]

$t[^table::set{$a-tab-b}]
=$t.a=
<hr>

$t[^table::set[nameless]{^taint[$a-tab-b]}]
=$t.0=
<hr>

$t[^table::set{^untaint{^taint[$a-tab-b]}}]
=$t.a=

#^t.append{1	2}

@mail3[]
^mail:send[
	$.from[Александр Петросян <paf@mail.design.ru>]
	$.to[Александр Петросян <paf@mail.design.ru>]
	$.subject[проверка2]
	$.body[
		$.text[
			$.content-type[$.value[text/plain] $.charset[windows-1251]]
			$.body[проверка^taint[uri][москва]=]
		]
		$.attachment[
			$.value[^file::load[text;index.html]]
			$.file-name[привет всем.html]			
		]
	]
]


@ttime[]
$now[^date::now[]]
$now.hour:$now.minute

@tupper[]
$t[abcABCабвАБВ]
$t<br>
^t.upper[]

@treplace[]
$copy-paste-clean[^table::set{a b
.	_
,	_
+	_
&	_
?	_
=	_}]

$cache_key[^taint[в.а,с+я]&был?тут=недавно.cache]
# почему-то этот replace роняет апач в 500 ошибку :(
#^cache_key.replace[$copy-paste-clean]
$test[abc]
^test.save[$cache_key]saved<br>
$cache[^file:list[.;\.cache^$]]
^file:delete[$cache_key]deleted($cache.name)<br>



@xslt2[]
$xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?>
<document><block><p>привет</p></block></document>
}]
^show_xdoc2[$xdoc]
^show_xdoc2[^xdoc.transform[templates/_document.xslt]]
<hr>


@tcache2[]
^cache[$DB_HOME/keyключ](2){
	^math:random(100)
}

@ttaintuntaint[]
<!-- некий панковский заголовок с буковкой C в круглых скобках -->^taint[html][

]zz
<hr>
^untaint[html]{1^taint[  ]2  3}


@tappend2[]
$t[^table::set{a	b}]^t.append{1	2}$t.a

@badvsnprintf[]
^connect[zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz]{
}


@badoracequoting[]
$SQL.connect-string[oracle://webspb:webpwd@mts?NLS_LANG=RUSSIAN_AMERICA.CL8MSWIN1251&NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS]
^connect[$SQL.connect-string]{
^void:sql{delete from paf}
^void:sql{insert into paf values (1, '$form:text')}
$paf[^table::sql{select * from paf}]
^paf.menu{
	$paf.id: ^untaint{$paf.block}<hr>

}
<hr>


^rem{
$news[^table::sql{select description from news}[$.limit(3)]]
^news.menu{
	^untaint{$news.description}<hr>

}
<hr>
}

$tables[^table::sql{select table_name from user_tables}]
^tables.menu{
$tables.table_name<br>
}

}
<hr>
$env:PATH

@badconstructors[]
$bred[^string::length[]]
$bred[^response::clear[]]
$bred[^int::int[]]


@xloadwrongtable[]
$constr[^xdoc::load[wrongtable.xml]]
^show_xdoc2[$constr]

@xsetwrongtable[]
$constr[^xdoc::set{<?xml version="1.0" encoding="windows-1251z" ?>
<block-list>^untaint[as-is]{$constructor}</block-list>}]


@tablecolumnerror[]
$t[^table::set{a}]
$t.$a

@roll[]
#$date[^date::set(1970;1;2)]
#^date.roll[month](-1)
$date[^date::set(2038;1;1)]
^date.roll[month](+1)
$date.year  $date.month  $date.day

@cookie2[]
#=$cookie:clientType[$.value[test]]=<br>
=$cookie:CLASS.clientType=<br>


@tableset[]
$a[^table::set{a
1
2}]
^eval(100\$a)



@zzz[]


$constructor[
<block1 name="main_srvr" type="0" label="Основное тело" />
<block2 name="main_srvr2" type="0" label="Основное тело" />
]

$constr[^xdoc::set{<?xml version="1.0" encoding="windows-1251" ?>
<block-list>^untaint[as-is]{$constructor}</block-list>}]

$children[$constr.documentElement.childNodes]
^if($children){
^for[i](1;^children._count[]){
	$node[$children.$i]
	$node.nodeName<br>
}
}
   

@thashforeach3[]
$h[
	$.a[1] 
	$.b[2]
]
$c[^table::set{a
^h.foreach[key;value]{$value
}}]
$c.a

@thashforeach2[]
$h[
	$.a[1] 
	$.b[2]
]
$c[
^h.foreach[key;value]{
	$.$key[$value]
}
]
$c.b

@thashforeach[]
$h[
	$.a[1] 
	$.b[2]
]
^h.foreach[key;value]{
	$key=$value<br>
}

@thashdelete[]
$h[$.a[1] $.b[2]]
was:<br>
count=^h._count[] <br>
b='$h.b' <br>

^h.delete[b] 

now:<br>
count=^h._count[] <br>
b='$h.b' 

@sappend[]
$test[123]
^test.save[test]
^test.save[append;test]

@tappend[]
$test[^table::set{a	b
a1	b1}]
^test.save[test]
$test[^table::set{a	b
a2	b2}]
^test.save[append;test]


@tform[]
^if(def $form:new_file){y}{n}
<form method="post" enctype="multipart/form-data">
<input type="file" name="new_file" />
<input type=submit>
</input>

@formattest[]
$size(15.124)

^size.format{%.2f}

@filelist[]
$html[^file:list[.;\.html^$]]
^html.menu{
	$html.name<br>
}
<hr>

@безнадёжна_попытка_поправить_непоправимое[]
$dom_from_disk[^xdoc::load[input.xml]]
$dom_created_in_air[^xdoc::create[doc]]
^dom_created_in_air.documentElement.appendChild[^dom_from_disk.documentElement.cloneNode(1)]
^show_xdoc2[$dom_created_in_air]


@tcache[]
#^hashfile:clear[cache]
$code[^hashfile::open[$DB_HOME;cache]]
^code.cache[key](2){
	^math:random(100)
#	^code.delete[]
}

@thashfileexp[]
$hf[^hashfile::open[$DB_HOME;hashfile]]
$hf.paf[$.value[крут] $.expires(3)]
paf=$hf.paf
<hr>
^hf.foreach[key;value]{
	$key=$value<br>
}
<hr>
$hash[^hf.hash[]]
=$hash.paf=
<hr>

@tcounter[]
^tcounterone[$DB_HOME]
other root:
^tcounterone[${DB_HOME}2]
again, first:
^tcounterone[$DB_HOME]

@tcounterone[DB_HOME]
$counter[^hashfile::open[$DB_HOME;counter]]
#^counter.clear[]
^counter.transaction{
#	$counter.value(10)
	$counter.value($counter.value+1)
#	^counter.delete[value]
	$counter.value
}
<hr>
^rem{
$hash[^counter.hash[]]
=$hash.value=
<hr>
}

@tablehash[]
$productList[^table::set{id	name
1	носки
2	валенки
3	ушанка
}]

#скажем, у первого дилера
$firstPriceList[^table::set{id	price
1	0.3
3	1000
}]

$firstPriceHash[^firstPriceList.hash[id]]

^productList.menu{
    продукт "$productList.name" | цена у first: $firstPriceHash.[$productList.id].price<br>
}


@hashfile[]
$hf[^hashfile::assign[hashfile]]
#$hf.paf[крут5]
paf=$hf.paf

@formclass[]
^$form:CLASS.a=$form:CLASS.a

@domdata[]
^if(1){
#	$a{^hren[]}
}
$a
$xdoc[^xdoc::create[doc]]
$doc[$xdoc.documentElement]
$name[^doc.appendChild[^xdoc.createElement[name]]]
$text[^name.appendChild[^xdoc.createTextNode[петросян&coz]]]
^untaint[as-is]{=$text.nodeValue=}

@domedit[]
^domdata[]
#$paf.nodeName<br>
#$doc.documentElement.nodeName<br>

^show_xnode1[$xdoc.documentElement;0;1]
<hr>
^show_xdoc2[$xdoc]
<hr>

@domxslt[]
^domdata[]
^show_xdoc2[^xdoc.transform[global.xsl;$.param1[123/]]]
<hr>

@lsplit2[]
$path[/optics/]
$pathTable[^path.lsplit[/]]
^pathTable.menu{
	^if(def $pathTable.piece){
		=$pathTable.piece=
	}
}


@faceesize[]
$k(2)
$pict[^image::load[paf.gif]]
$small[^image::create($pict.width/$k;$pict.height/$k)]
^small.copy[$pict](0;0;$pict.width;$pict.height;0;0;$small.width;$small.height;250)
$response:body[^small.gif[]]

@imageresize[]
$k(2)
$pict[^image::create(400*$k;200*$k)]
$pict.line-width(2)
^pict.arc($pict.width/2;$pict.height/2;$pict.width-1;$pict.height-1;0;360;0x000000)
^pict.arc($pict.width/2;$pict.height/2;$pict.width-20;$pict.height-20;0+20;360-20;0xff0000)
#^pict.arc($pict.width/2;$pict.height/2;$pict.width;$pict.height;0;360;0xff0000)
^pict.circle($pict.width/2;$pict.height/2;$pict.height/2-20;0x0000ff)
^pict.arc($pict.width/2;$pict.height/2;$pict.height-26;$pict.height-26;0+20;360-20;0xff0000)
$response:body[^pict.gif[]]

#$small[^image::create($pict.width/$k;$pict.height/$k)]
#^small.copy[$pict](0;0;$pict.width;$pict.height;0;0)
#^small.copy[$pict](0;0;$pict.width;$pict.height;0;0;$small.width;$small.height;0)

#$response:body[^small.gif[]]


@tintdefault[]
#$abc[abc]
$abc[33]
^abc.int[z]
#^abc.int(123)

@ifassignhash[]
$h[^if(1){$.a(1);$.a(2)}]
$h.a

@ifpasshash[]
$a[$.e[a]]
$b[$.e[b]]
^ifpasshashdest[^if(1){$a;$b}]
#$x[^if(1){$a}{$b}]
#^ifpasshashdest[$x]

@ifpasshashdest[p]
$p.e

@movedir[]
^file:move[a;deeper/a]

@replace[]
$a[12^;3]
^a.replace[^table::set{from	to
2^;	!
}]


@set[]
^setdata[]
^a.add[$b]
add:$a.3<br>

^setdata[]
^a.sub[$b]
sub2:$a.2<br>
sub1:$a.1<br>

^setdata[]
$c[^a.union[$b]]
union3:$c.3<br>
union2:$c.2<br>

^setdata[]
$c[^a.intersection[$b]]
intersection3:$c.3<br>
intersection2:$c.2<br>

^setdata[]
intersects:^if(^a.intersects[$b]){y;n}<br>
intersects2:^if(^a.intersects[ ]){y;n}<br>


<hr>

@setdata[]
$a[$.1[a1] $.2[a2]]
$b[        $.2[b2] $.3[b3]]


@hash[]
$h[^hash::create[$._default[123]]]
$h.paf[not kretin]
$h.paf<br>
=$h.that=<br>

@methresult[]
$result[^table::set{1}]

@terror[]
^error[method z must be called with z]

@syntax1[]
#^a[^b]

@syntax2[]
#^a[

@ssave[]
$abc[abc]
^abc.save[abc]

@calendar[]
$year(2002)
$month(12)
${year}-${month}:<br>
$week_days[^date:calendar[rus]($year;$month)]
<pre>
^week_days.menu{^for[wday](0;6){^if($week_days.$wday){$week_days.$wday;&nbsp^;&nbsp^;} }=$week_days.week,$week_days.year=<br>}
</pre>

@thash[]
$table[^table::set{id	name	age
1	paf	278
2	пиф	234
}]
$hash[^table.hash[id;^table::set[nameless]{id
name}]]
$hash.2.id $hash.2.name $hash.2.age

@tdef[]
$s[0]
if 0=^if($s){}{n}<br>
if def 0=^if(def $s){y}{}<br>
<hr>

@ford[]
^for[i](0;5){$i}{($i)}

@tif[]
^if[def]{y;n}

@image[]
$pict[^image::create(400;200)]
^pict.arc($pict.width/2;$pict.height/2;$pict.width-1;$pict.height-1;0;360;0x000000)
^pict.arc($pict.width/2;$pict.height/2;$pict.width-10;$pict.height-10;0+10;360-10;0xff0000)
#^pict.arc($pict.width/2;$pict.height/2;$pict.width;$pict.height;0;360;0xff0000)
^pict.circle($pict.width/2;$pict.height/2;$pict.height/2-10;0x0000ff)
^pict.arc($pict.width/2;$pict.height/2;$pict.height-26;$pict.height-26;0+10;360-10;0xff0000)
$response:body[^pict.gif[]]



@mail2[]
^mail:send[
	$.message-id[<6615%1@parser.ru>]
	$.content-type[$.value[text/plain] $.charset[windows-1251]]
	$.from[Александр Петросян <paf@design.ru>]
	$.to[Александр Петросян <paf@design.ru>]
	$.subject[проверка проверка]
	$.text[проверка]
]

@cookie[]
#$env:HTTP_COOKIE<br>

#$cookie:переменная[test тест ТЕСТ2]
=$cookie:переменная=<br>
#$cookie:переменная2[test тест ТЕСТ3]
=$cookie:переменная2=<br>
=$cookie:CLASS.переменная2=<br>

@response[]
#^if($form:reload){
	$response:refresh[$.value[0] $.url[./t.html?uri=$env:SERVER_NAME]]
#}

@xslt[]
^xdata[]
$transformed[^xdoc.transform[global.xsl;$.param1[123/]]]
^show_xdoc2[$transformed]

@regexp2[]
$s[  select]
$s[^s.match[^^\s*][]{!}]
$s

@header[]
$response:refresh[
	$.value[0]
	$.url[http://design.ru?a=^taint[123]]
]

@ttablerem[]
$table[^table::load[a.cfg]]
^table.menu{$table.a}

@tconnect[]
^connect[mysql://test:test@paf/test?charset=cp1251_koi8&compress=1&timeout=1&named_pipe=1]{
$tables[^table::sql{show tables}]
#$cols[^tables.columns[]]
#$cols.column
^tables.menu{
	$tables.[Tables_in_test]<br>
}
}

@pcre[]
$s[1 2]
^s.match[\s;ig]{!}
#^s.match[\d;ig]{!}


@regexp[]
$s[abcАБВ]
^if(^s.match[б][i]){y}{n}

@mail[]
#$ORIGINS(1)
^mail:send[
	$.from[paf@design.ru]
	$.to[paf@design.ru]
	$.body[1
	
	2
	
	
		3]
]

@fori[][i]
^for[i](1;3){... =$i= ...}

@xdata0[]
#$response:content-type[$.value[text/html] $.charset[windows-1251]]
$xdoc[^xdoc::set{<?xml version="1.0" encoding="windows-1251"?>
<!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
<people>
	<man id="1" имя="word слово">
		<name>P&#171^;AF	B</name>
	</man>
	   	<man id="2">
   			<name>ПИФ^taint[&]</name>
	   	</man>
</people>
}]

@xdata[]
#$response:content-type[$.value[text/html] $.charset[windows-1251]]
$xdoc[^xdoc::create{<?xml version="1.0" encoding="windows-1251"?>
<!--DOCTYPE people SYSTEM "D:\Y\parser3project\parser3\src\www\htdocs\people.dtd"-->
<people>
	<man id="1" имя="word слово">
		<name>P&#171^;AF	B</name>
	</man>
	   	<man id="2">
            <name>ПИФ^taint[&]</name>
	   	</man>
</people>
}]

@xml[]
^xdata[]

^show_xdoc2[$xdoc]<hr>
#^show_xnode1[$xdoc]<hr>
$people[^xdoc.select[*/man]]
#^show1[]
^show_xnodes1[$people]<hr>
#^people.0.owner.hren[]

^show_xnode1[^xdoc.selectSingle[*/man[2]/name];0;1]<hr>

by id:
^show_xnode1[^xdoc.getElementById[1];0;1]
<hr>

@show1[array]
^for[i](0;^array._count[]-1){
    $x[$array.$i]
	$x.firstChild.nodeValue: 
		$pattributes[$x.parentNode.attributes]
		^if(^pattributes._count[]){
			$pattributes.id.name=$pattributes.id.nodeValue
		}
	<br>
}
	
@show_xnodes1[array][i]
^for[i](0;^array._count[]-1){
	^show_xnode1[$array.$i;0;1]
}

@show_xnode1[x;level;single][l]
^if(def $x){
    ^for[l](0;$level-1){&nbsp^;&nbsp^;&nbsp^;&nbsp^;}
    ^if($x.nodeType == $xnode:ELEMENT_NODE){
    	&lt^;$x.nodeName
	    $pairs[$x.attributes]
	    ^if(def $pairs){
	    	$names[^pairs._keys[]]
	    	^names.menu{ $names.key="$pairs.[$names.key].nodeValue"}
	    }
	    &gt^;
    }{
    	[$x.nodeType]
    }
    
    ^if(def $x.nodeValue){$x.nodeValue}<br>
    ^show_xnode1[$x.firstChild]($level+1)
    ^if(!$single){
	    ^show_xnode1[$x.nextSibling]($level)
    }

    ^if($x.nodeType == $xnode:ELEMENT_NODE){
    ^for[l](0;$level-1){&nbsp^;&nbsp^;&nbsp^;&nbsp^;}&lt^;/$x.nodeName&gt^;<br>
    }
}

@show_xdoc2[xdoc]
^xdoc.save[out/save.xml;
#	$.encoding[utf-8]
	$.method[xml]
]
$file[^xdoc.file[
	$.encoding[utf-8]
	$.method[html]
]]
^file.save[text;out/save_file.html]
#$response:body[^xdoc.file[	$.media-type[text/paf]  ]]
<pre>^taint[html][^xdoc.string[
	$.method[html]
#	$.encoding[utF-8]
#  	$.omit-xml-declaration[yes]
#	$.standalone[no]
#	-$.doctype-public[-//W3C//DTD XHTML]
#	-$.doctype-system[/a/b/c/]
#	$.indent[yes]
#	$.media-type[text/paf]
]]
</pre>

E-mail: