亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? focusparser.pm

?? ACE編程的一本經典BIBLE的源代碼,喜歡網絡編程的別錯過
?? PM
?? 第 1 頁 / 共 2 頁
字號:
#########################################################################
# A Simple Parser for automating the specializations crated in FOCUS.
#
# @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
#
# FOCUSParser.pm,v 1.1 2005/09/29 21:31:19 arvindk Exp
#
# This parser, parses the specialization file given as an input argument
# and *individually* visits the tags in a pre-determined order to weave
# in the specializations.
# NOTE: This parser will make N passes over the file, where N equals
# to the number of tags defined in the specialization file. This
# approach is intentional as it servers current needs. Future versions
# may enhance this parser and Visit methods to be more intelligent.
###########################################################################
package FOCUSParser;

# for MY own preferences!
use strict;

# XML related operations
use XML::DOM;

# Generic file operations
use FileHandle;

# Creating files and renaming them
use File::Copy;

# Creating directories
use File::Path;

############################################
# GLOBAL CONSTANTS
###########################################
my $FOCUS_PREPEND_TAG = "\/\/@@ ";

####################################################################
# banner: A function that returns the FOCUS banner transformation
# for just clarity purpose only.
###################################################################
sub FOCUS_banner_start
{
  my $banner_str = "// Code woven by FOCUS:\n";
  return $banner_str;
}

sub FOCUS_banner_end
{
  my $banner_str = "// END Code woven by FOCUS\n";
  return $banner_str;
}

#########################################################################
# Visit_ADD: Visit a add element defined in the transform.
# In particular look for the hook defined: search it in the source file
# and add the data in the <data> tags into the file starting from the
# hook, but not including the hook.
##########################################################################
sub Visit_Add
{
  my ($add, $copy_file_name) = @_;

  # Open the copy and transform it
  open (IN, "+<". $copy_file_name) ||
    die "cannot open file: " . $copy_file_name;

  # To update a file in place, we use the temporary
  # file idiom. Perl says this is the best way to
  # do this!
  my $copy_file_tmp = $copy_file_name . "tmp";
  open (OUT, ">". $copy_file_tmp) ||
    die "cannot open temporary file for modying file:" . $copy_file_name;

  # get the hook element defined in the add element
  my $hook = $add->getElementsByTagName ('hook');

  # ensure length of hook == 1;
  if ($hook->getLength != 1)
  {
    print "Assertion Error: An <add> element can have only \
           one <hook> definition";

    # clean up
    close (IN);
    close (OUT);

    # Diagnostic comment
    print " [failure]... Reverting changes \n";

    unlink ($copy_file_name);
    unlink ($copy_file_name . "tmp");
    exit (1);
  }

  # Check if the hook is present in the file at all
  my $hook_str = $hook->item(0)->getFirstChild->getNodeValue;
  chomp ($hook_str);

  #//@@ For now, due to problem with the hook string
  my $search_str = $hook_str;

  while (<IN>)
  {
    if (/$search_str/)
    {
      # Do not remove the hook! It needs to be present
      print OUT $_;

      # FOCUS banner start
      print OUT FOCUS_banner_start;

      # parse <data> ... </data> elements for this add tag
      my @data_list = $add->getElementsByTagName ('data');
      foreach my $data (@data_list)
      {
	my $data_item = $data->getFirstChild->getNodeValue;
	chomp ($data_item);

	# Insert the item
	print OUT "$data_item \n";
      }

      # FOCUS banner end
      print OUT FOCUS_banner_end;
    }
    else
    {  print OUT $_; }
  }

  # Everything went well!
  close (IN);
  close (OUT);

  # replace in place the old file with the new one
  rename ($copy_file_tmp, $copy_file_name);
}

###########################################################################
# Visit_Remove: Visit a <remove> element defined in the transform.
# In particular look for the hook defined: search it in the source file
# and remove the element's value from the source file being searched.
############################################################################
sub Visit_Remove
{
  my ($remove, $copy_file_name) = @_;

  # obtain the data to be removed
  my $search = $remove->getFirstChild->getNodeValue;
  chomp ($search);

  # Open the copy and transform it
  open (IN, "+<" . $copy_file_name) ||
    die "cannot open file: " . $copy_file_name;

  # Update the file in place
  my $copy_file_name_tmp = $copy_file_name . "tmp";
  open (OUT, ">". $copy_file_name_tmp) ||
    die "cannot open temporary file for modying file:" . $copy_file_name;;

  # Removing something is same as search and replace. Replace with ""
  my $replace = "";

  foreach my $line (<IN>)
  {
    if ($line =~/$search/)
    {
      # We do not print the banner information
      # as we have removed something and
      # print the banner will be redundant!

      # replace <search> with <replace>
      $line =~ s/$search/$replace/;

      print OUT $line;
    }
    else { print OUT $line; }
  }

  # Everything went well!
  close (IN);
  close (OUT);

  # replace in place the old file with the new one
  rename ($copy_file_name_tmp, $copy_file_name);
}

#########################################################################
# Visit_Substitute: Visit a <substitute> element defined in the transform.
# In particular look for the <search> element and replace it with the
# <replace> element.
#########################################################################
sub Visit_Substitute
{
  my ($substitute, $copy_file_name) = @_;

  # Open the copy and transform it
  open (IN, "+<". $copy_file_name) ||
    die "cannot open file: " . $copy_file_name;

  # To update a file in place, we use the temporary
  # file idiom. Perl says this is the best way to
  # do this!
  my $copy_file_name_tmp = $copy_file_name . "tmp";
  open (OUT, ">". $copy_file_name . "tmp") ||
    die "cannot open temporary file for modying file:" . $copy_file_name;;

  # check if the match-line keyword is set or not
  my $match_line = $substitute->getAttribute('match-line');

  # <search> .... </search>
  my $search_list = $substitute->getElementsByTagName ('search');

  # ensure length of search == 1;
  if ($search_list->getLength != 1 ||
      $search_list->getLength == 0)
  {
    print "Assertion Error: A <substitute> element can have only \
          one <search> element";
    close (IN);
    close (OUT);

    # Dianostic comment
    print " [failure] reverting changes \n";

    unlink ($copy_file_name);
    unlink ($copy_file_name_tmp);
    exit (1);
  }

  # <replace> .... </replace>
  my $replace_list = $substitute->getElementsByTagName ('replace');
  if ($replace_list->getLength != 1 ||
      $replace_list->getLength == 0)
  {
    print "Assertion Error: A <substitute> element can have only \
           one <replace> element";
    close (IN);
    close (OUT);
    unlink ($copy_file_name);
    unlink ($copy_file_name_tmp);
    exit (1);
  }

  # <search> and <replace> element values
  my $search = $search_list->item(0)->getFirstChild->getNodeValue;
  my $replace = $replace_list->item(0)->getFirstChild->getNodeValue;

  # remove spaces
  chomp ($search);
  chomp ($replace);

  # Search and replace string in the file
  foreach my $line (<IN>)
  {
    # Check if the match line attribute is set. If so then
    # ignore word boundaries. If not, honor word boundaries.
    my $line_matched = 0;
    if (! $match_line)
    {
      if ($line =~/\b$search\b/)
      {
        $line_matched = 1;
      }
    }
    else
    {
      if ($line =~ /$search/)
      {
        $line_matched = 1;
      }
    }

    # Check if the line matched
    if ($line_matched)
    {
      # FOCUS banner start
      print OUT FOCUS_banner_start;

      # replace <search> with <replace>
      # Caveat: What if <search> occures multiple
      # times in the line? Here is how we handle
      # it
      $line =~ s/$search/$replace/g;

      print OUT $line;

      # FOCUS banner end
      print OUT FOCUS_banner_end;
    }
    else { print OUT $line; }
  }

  # everything went well!
  close (IN);
  close (OUT);

  # replace in place the old file with the new one
  rename ($copy_file_name_tmp, $copy_file_name);
}

#########################################################################
# Visit_Comment: Visit the comment-region hooks defined in the
# source code and comment out all code between start and finish of that
# region
#########################################################################
sub Visit_Comment
{
  my ($comment, $copy_file_name) = @_;

  # check for the comment region tags and
  # comment out the region
  my $start_hook_tag = $comment->getElementsByTagName ('start-hook');
  my $end_hook_tag   = $comment->getElementsByTagName ('end-hook');

  if ($start_hook_tag->getLength != 1 ||
      $end_hook_tag->getLength != 1)
  {
    print "Assertion Error: A <comment> element can have only \
           one pair of <start-hook> and <end-hook> tags";
    unlink ($copy_file_name);
    exit (1);
  }

  my $start = $start_hook_tag->item(0)->getFirstChild->getNodeValue;
  my $end =   $end_hook_tag->item(0)->getFirstChild->getNodeValue;

  # What are we looking for:
  # We need to start from "//" . FOCUS_PREPEND_TAG . $hook
  # i.e. //[[@ <blah blah>
  # This will be the format for both start and end
  # //@@ Problems with the hook string
  my $start_hook = $FOCUS_PREPEND_TAG . $start;
  my $end_hook   = $FOCUS_PREPEND_TAG . $end;

  # Open the copy and transform it
  open (IN, "+<". $copy_file_name) ||
    die "cannot open file: " . $copy_file_name;

  my $copy_file_name_tmp = $copy_file_name . "tmp";
  open (OUT, ">". $copy_file_name_tmp) ||
    die "cannot open temporary file for modying file:" . $copy_file_name;

  my $start_commenting = 0;
  while (<IN>)
  {
    if (! /$start_hook/ &&
        ! /$end_hook/)
    {
      if ($start_commenting)
      { print OUT "// " . $_; }
      else
      { print OUT $_; }
    }
    else
    {
      if (/$start_hook/)
      {
        $start_commenting = 1;
        print OUT $_; # print start hook!
      }
      else
      {
        $start_commenting = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久久久久久久久 | 五月综合激情日本mⅴ| bt7086福利一区国产| 中文av一区二区| 色综合久久久久久久久久久| 亚洲欧美色一区| 欧美日韩激情一区二区三区| 九九**精品视频免费播放| 欧美不卡在线视频| 成人中文字幕电影| 亚洲人成在线播放网站岛国| 欧美日韩精品系列| 国产精品一区二区你懂的| 国产精品欧美一级免费| 日本韩国欧美在线| 另类的小说在线视频另类成人小视频在线 | 亚洲欧美色图小说| 欧美另类videos死尸| 激情欧美日韩一区二区| 国产精品久久影院| 69久久夜色精品国产69蝌蚪网| 久久69国产一区二区蜜臀| 国产精品福利在线播放| 欧美肥妇bbw| 成人丝袜视频网| 日韩激情视频在线观看| 中文字幕成人网| 欧美精品日日鲁夜夜添| jlzzjlzz亚洲女人18| 天天射综合影视| 中文字幕一区二区三区在线播放 | 色偷偷一区二区三区| 久久精品免费观看| 亚洲精品成人天堂一二三| 精品欧美一区二区在线观看| 99re热视频精品| 激情综合色播激情啊| 一区二区三区不卡在线观看 | 亚洲免费观看高清完整版在线观看 | 午夜成人免费视频| 国产精品盗摄一区二区三区| 欧美一区二区日韩一区二区| 91在线观看地址| 国产又粗又猛又爽又黄91精品| 亚洲国产视频在线| 日韩理论片在线| 精品国产免费一区二区三区香蕉| 欧美专区日韩专区| av在线播放成人| 国产精品99久久久久久有的能看| 亚洲国产中文字幕在线视频综合 | 欧美午夜一区二区三区免费大片| 国产高清精品在线| 久久国产三级精品| 丝袜美腿高跟呻吟高潮一区| 伊人性伊人情综合网| 亚洲国产精品t66y| 久久综合99re88久久爱| 日韩免费视频一区二区| 欧美精品第1页| 欧美午夜免费电影| 日本高清不卡视频| 色综合久久综合网97色综合 | 国产精品蜜臀在线观看| 久久婷婷久久一区二区三区| 欧美电视剧免费全集观看| 欧美日韩精品三区| 在线观看91精品国产麻豆| 欧美日韩一区二区三区视频| 91精品福利视频| 在线视频你懂得一区二区三区| 91视视频在线观看入口直接观看www | 一区二区三区在线观看国产| 国产精品久久久久久久久久免费看| 久久精品人人爽人人爽| 亚洲精品一区在线观看| 日韩免费看的电影| 精品国产制服丝袜高跟| 久久亚洲一级片| 久久综合九色综合久久久精品综合| 精品国产三级电影在线观看| 久久精品日产第一区二区三区高清版| 2019国产精品| 国产精品免费看片| 亚洲人成人一区二区在线观看| 国产精品国产精品国产专区不片| 一区在线播放视频| 亚洲午夜久久久久久久久电影网 | 蓝色福利精品导航| 国产一区91精品张津瑜| 福利一区福利二区| 99re亚洲国产精品| 欧美欧美欧美欧美首页| 精品欧美一区二区三区精品久久| 国产区在线观看成人精品| 自拍偷拍亚洲激情| 亚洲mv大片欧洲mv大片精品| 日本欧美大码aⅴ在线播放| 黄一区二区三区| 99久久精品费精品国产一区二区| 色噜噜狠狠色综合欧洲selulu| 欧美日韩黄色影视| 久久这里都是精品| 综合在线观看色| 日本成人在线不卡视频| 国产成人免费9x9x人网站视频| 91啦中文在线观看| 91麻豆精品国产自产在线观看一区 | 成人涩涩免费视频| 欧美日韩三级视频| 欧美成人bangbros| 亚洲激情男女视频| 激情综合色播激情啊| 91成人在线免费观看| 精品久久久久久久久久久院品网| 日韩理论片一区二区| 久久精品av麻豆的观看方式| 成人app在线观看| 91麻豆精品国产91久久久久久 | 亚洲男同性视频| 三级成人在线视频| www.亚洲色图.com| 日韩欧美一二三区| 一级日本不卡的影视| 国产高清精品在线| 欧美美女直播网站| 国产精品国产三级国产aⅴ原创| 亚洲午夜激情网页| www.日韩大片| 日韩欧美成人午夜| 一区二区三区精品视频在线| 国产乱妇无码大片在线观看| 欧美日韩国产一区| 成人免费一区二区三区在线观看| 日韩制服丝袜先锋影音| voyeur盗摄精品| 久久久国产精华| 欧美aaa在线| 欧美日韩亚洲综合一区| 亚洲欧美偷拍卡通变态| 国产.欧美.日韩| 久久人人爽人人爽| 麻豆精品一区二区| 欧美久久久久中文字幕| 亚洲一级片在线观看| 91蜜桃免费观看视频| 中文字幕av一区二区三区高 | 午夜视频在线观看一区二区 | 欧美在线短视频| 最新久久zyz资源站| 国产盗摄女厕一区二区三区| 欧美不卡一区二区三区| 日本不卡高清视频| 91麻豆精品国产91久久久更新时间 | 日韩黄色一级片| 欧美午夜精品久久久| 亚洲美女屁股眼交| 99re6这里只有精品视频在线观看| 日本一区二区免费在线| 精品一区二区三区欧美| 精品国产一区二区国模嫣然| 日韩美女视频一区| 91色在线porny| 亚洲视频在线一区观看| 91天堂素人约啪| 中文字幕日本不卡| 色呦呦网站一区| 一区二区三区免费看视频| 欧美视频精品在线观看| 亚洲国产精品视频| 欧美日韩不卡视频| 天天综合天天做天天综合| 制服丝袜成人动漫| 国产综合色精品一区二区三区| 久久综合九色综合97婷婷女人| 国产精品99久久久| 国产亚洲欧美中文| 91亚洲午夜精品久久久久久| 樱花影视一区二区| 777奇米成人网| 国产精品一线二线三线| 国产亚洲欧洲一区高清在线观看| 成人aaaa免费全部观看| 亚洲日穴在线视频| 欧美四级电影在线观看| 日韩国产在线观看| 国产亚洲婷婷免费| 色综合一区二区| 日产国产欧美视频一区精品| 久久久久久久综合日本| 一本久久精品一区二区| 亚洲电影激情视频网站| 精品裸体舞一区二区三区| 成人av网在线| 日韩精品一二区| 欧美国产精品劲爆| 欧美日韩中文字幕一区| 国产真实乱子伦精品视频| 亚洲免费观看视频| 精品sm捆绑视频|