⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc2016.txt

📁 著名的RFC文档,其中有一些文档是已经翻译成中文的的.
💻 TXT
📖 第 1 页 / 共 3 页
字号:
      {prompt      {Topic Keywords}}      {response    {}}   }   {EXPINFO      {name        {Comments}}      {prompt      {Comments}}      {response    {}}   }   {ACTSPEC       {proc mapResponsesToDejanews {} {           set resp ""           if {[uraAreResponsesSet {Topic Keywords}]} {             lappend resp [list query [uraGetSpecResponse {             Topic Keywords}]]           }           return $resp         }      proc uraRun {} {        global errorInfo        foreach serv [uraListOfServices] {          set u [uraGetServiceURL $serv]          switch -- $serv {            dejanews {              if [catch {                set query [mapResponsesToDejanews]                if {$query != {}} {                    set result [uraHTTPPostSearch $u $query]                    if {$result != ""} {                      set list [dejanews_uraHTTPPostCanonicalize                      $result]                      puts $list                    }                  }              }] {                puts stderr $errorInfo              }            }            default {              # can't handle other searches, yet.            } } } }      }Daigle, et. al.               Experimental                     [Page 15]RFC 2016                Uniform Resource Agents             October 1996   }   {RESPFILT      {       proc dejanews_uraHTTPPostCanonicalize {htmlRes} {         set result {}         set lines {}         set clause {}         set garb1 ""         set garb2 ""         # Get the body of the result page -- throw away leading and         # trailing URLs         regexp {([^<PRE>]*)<PRE>(.*)</PRE>.*}                 $htmlRes garb1 garb2 mainres         set lines [split $mainres "\n"]         foreach clause $lines {           if [regexp           {<DT>.*(..\/..).*<A HREF="([^"]*)">([^<]*)</A>.*<B>([^<]*).*}                $clause garb1 dt relurl desc grp] {             lappend r [list HEADLINE [format "%s    (%s, %s)"                        [string trim $desc] \                 [string trim  $grp] $dt]]             lappend r [list URL [format                        "http://www.dejanews.com/cgi-bin/%s" $relurl]]             lappend r [list TYPE "text/plain"]             lappend result $r           }         }         return $result       }      }   }}Daigle, et. al.               Experimental                     [Page 16]RFC 2016                Uniform Resource Agents             October 1996Appendix 3  -- Sample Silk Tcl URA   The following is a valid Silk Tcl URA.  For more information on the   implementation and structure of Silk-specific URAs, see the "URA   Writers Guide" that accompanies the distribution of the Silk software   (available from <http://www.bunyip.com/products/silk>).# ----------------------------------------------------------------------##                             URA initialization## ----------------------------------------------------------------------## Initialize the URA, its search specs and searchable services.## URA init.set uraDebug 1uraInit {  {name {DejaNews Search}}  {author {Leslie Daigle}}  {version {1.0}}  {description "This URA will search for UseNet News articles."}  {help "This is help on UseNet News search script."}}## bug: handling of choices/labels is kind of gross.## Search spec. init.foreach item {  {    {name        {Topic Keywords}}    {field       Topic}    {tag         STRING}    {description {Keywords to search for in news articles}}    {prompt      {Topic Keywords}}    {help        {Symbols to look up, separated by spaces.}}    {type        STRING}    {subtype     {}}    {allowed     .*}    {numvals     1}    {required    0}Daigle, et. al.               Experimental                     [Page 17]RFC 2016                Uniform Resource Agents             October 1996    {response    {}}    {respset     0}  }} {  uraSearchSpecInit $item}uraAnnotationInit {  {help        {Enter comments to store with an instance}}  {numvals     1}  {subtype     {}}  {response    {}}  {name        Comments}  {required    0}  {class       ANNOTATION}  {type        TEXT}  {description {General comments about this URA.}}  {respset     1}  {prompt      Comments}  {field       {}}  {allowed     .*}}uraResultInit {  {name {Related Pages}}  {contents { {    {HEADLINE {The DejaNews UseNet search service}}    {TYPE text/plain}    {URL http://www.dejanews.com}} }}}foreach item {  {    {name dejanews}    {protocol http-post}    {url http://marge.dejanews.com/cgi-bin/nph-dnquery}  }} {  uraServicesInit $item}proc dejanews_uraHTTPPostCanonicalize {htmlRes} {  set result {}  set lines {}Daigle, et. al.               Experimental                     [Page 18]RFC 2016                Uniform Resource Agents             October 1996  set clause {}  set garb1 ""  set garb2 ""  # Get the body of the result page  # -- throw away leading and trailing URLs  regexp {([^<PRE>]*)<PRE>(.*)</PRE>.*} $htmlRes garb1 garb2 mainres  set lines [split $mainres "\n"]  foreach clause $lines {    uraDebugPuts stderr [format "Line: %s" $clause]    if [regexp    {<DT>.*(..\/..).*<A HREF="([^"]*)">([^<]*)</A>.*<B>([^<]*).*} \         $clause garb1 dt relurl desc grp] {      uraDebugPuts stderr [format                           "Date: %s Rel URL: %s Desc: %s Group: %s"                           $dt $relurl $desc $grp]      lappend r [list HEADLINE [format "%s    (%s, %s)"                 [string trim $desc] \          [string trim  $grp] $dt]]      lappend r [list URL [format                 "http://www.dejanews.com/cgi-bin/%s" $relurl]]      lappend r [list TYPE "text/plain"]      lappend result $r    }  }  return $result}# ----------------------------------------------------------------------##                             Mapping procedures## ----------------------------------------------------------------------## There is one procedure, for each searchable service, to map the search# spec responses to a form suitable for inclusion into a search URL (or# whatever form the particular query procedure accepts).#Daigle, et. al.               Experimental                     [Page 19]RFC 2016                Uniform Resource Agents             October 1996##proc mapResponsesToDejanews {} {  set resp ""  if {[uraAreResponsesSet {Topic Keywords}]} {    lappend resp [list query [uraGetSpecResponse {Topic Keywords}]]  }  return $resp}## bug: need better error reporting# (i.e. which searches didn't work and why, etc.)#proc uraRun {} {  global errorInfo  foreach serv [uraListOfServices] {    set u [uraGetServiceURL $serv]    switch -- $serv {      dejanews {        if [catch {          set query [mapResponsesToDejanews]          uraDebugPuts stderr [format "%s: query is `%s'."          $serv $query]          if {$query != {}} {              set result [uraHTTPPostSearch $u $query]              if {$result != ""} {                uraDebugPuts stderr [format "%s: result is `%s'."                $serv $result]                set list [dejanews_uraHTTPPostCanonicalize $result]                uraDebugPuts stderr [format "%s: list is `%s'."                $serv $list]                puts $list              }            }        }] {          puts stderr $errorInfo        }      }      default {        # can't handle other searches, yet.      }Daigle, et. al.               Experimental                     [Page 20]RFC 2016                Uniform Resource Agents             October 1996    }  }}Daigle, et. al.               Experimental                     [Page 21]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -