亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美一级电影网站| 亚洲一区二区三区三| 欧亚洲嫩模精品一区三区| 国产99久久久精品| 另类专区欧美蜜桃臀第一页| 亚洲激情男女视频| 国产精品视频麻豆| 欧美电影免费观看高清完整版| 欧美日韩亚洲综合一区| 日本道免费精品一区二区三区| www.日韩av| 国产不卡视频在线观看| 337p亚洲精品色噜噜噜| 91精品国产综合久久国产大片| 日韩一区二区三区精品视频| 亚洲激情综合网| 成人动漫一区二区三区| 欧美影院精品一区| 日韩欧美三级在线| 日韩在线一区二区| 久久av老司机精品网站导航| 欧美三级一区二区| 亚洲男同性视频| 亚洲va欧美va国产va天堂影院| 丝袜亚洲另类欧美| 欧美日韩亚洲综合在线| 亚洲国产日产av| 国产在线日韩欧美| 成人av网站在线观看| 久久嫩草精品久久久精品一| 中文字幕在线免费不卡| 午夜日韩在线电影| 成人高清免费观看| 国产精品污www在线观看| 国产成人精品综合在线观看 | 色偷偷成人一区二区三区91| 欧美丝袜第三区| 亚洲一区日韩精品中文字幕| 色嗨嗨av一区二区三区| 亚洲精品免费播放| 欧美色中文字幕| 日韩电影在线观看一区| 成人激情综合网站| **性色生活片久久毛片| 日本高清成人免费播放| 亚洲成人精品在线观看| 日韩一区二区三区av| 久久99精品网久久| 欧美三级午夜理伦三级中视频| 亚洲超碰97人人做人人爱| 欧美日韩高清一区二区三区| 亚洲婷婷在线视频| 国产麻豆午夜三级精品| 日韩一区二区免费在线电影| 狠狠色狠狠色合久久伊人| 337p粉嫩大胆色噜噜噜噜亚洲| 中文字幕在线不卡一区二区三区| 99久久99久久精品免费观看| 国产日产欧美一区| 免费成人在线影院| 欧美日韩国产小视频在线观看| 日本午夜一区二区| 国产精品每日更新| 欧美乱熟臀69xxxxxx| 亚洲第一综合色| 久久影视一区二区| 日本二三区不卡| 久久99国产精品久久99果冻传媒| 欧美极品美女视频| 福利电影一区二区| 亚洲h动漫在线| 中文字幕精品综合| 欧美精品黑人性xxxx| 国产福利一区二区三区| 亚洲综合免费观看高清完整版在线 | 久久精品欧美日韩| 国产伦精一区二区三区| 亚洲精品成人天堂一二三| 久久影院午夜片一区| 欧美三级乱人伦电影| 国产91精品露脸国语对白| 日本亚洲免费观看| 亚洲一区二区在线免费看| 国产视频在线观看一区二区三区| 欧美高清精品3d| 91麻豆国产精品久久| 亚洲综合一区二区三区| 久久蜜桃av一区二区天堂| 制服丝袜在线91| 色婷婷激情综合| 成人黄色小视频在线观看| 激情文学综合插| 日韩av在线播放中文字幕| 亚洲欧美日韩在线播放| 亚洲国产电影在线观看| 日韩精品一区二区三区四区| 欧美视频在线观看一区| 色综合视频在线观看| 成人午夜视频福利| 一二三四社区欧美黄| 91精品久久久久久久91蜜桃 | 亚洲免费观看高清完整版在线观看| 欧美成人官网二区| 成人免费视频一区二区| 久久99久久精品| 蜜桃传媒麻豆第一区在线观看| 精品国产乱子伦一区| 成人黄色电影在线 | 欧美国产日本韩| 国产亚洲人成网站| 久久婷婷综合激情| 2017欧美狠狠色| 久久久五月婷婷| 久久综合九色综合97婷婷 | 欧美精品丝袜中出| 欧美无乱码久久久免费午夜一区 | av不卡一区二区三区| 成人性生交大合| 97久久人人超碰| 在线精品视频小说1| 欧美亚洲综合网| 日韩一区二区三区四区五区六区 | 一区二区三区精密机械公司| 亚洲色图欧美偷拍| 亚洲欧美成人一区二区三区| 亚洲精品写真福利| 午夜亚洲国产au精品一区二区| 五月婷婷激情综合| 久久99久久精品| 成av人片一区二区| 欧亚一区二区三区| 日韩精品中文字幕在线不卡尤物| 久久久久久久综合日本| 国产精品的网站| 久久久一区二区| 亚洲三级小视频| 手机精品视频在线观看| 国产在线精品一区二区三区不卡 | 亚洲三级视频在线观看| 亚洲国产精品久久艾草纯爱| 七七婷婷婷婷精品国产| 国产一区二区女| 91色综合久久久久婷婷| 欧美精品精品一区| 中文字幕乱码日本亚洲一区二区| 亚洲欧美一区二区三区久本道91| 亚洲第一综合色| 国产精品888| 国产精品伊人色| 色综合久久久久久久| 日韩欧美亚洲国产另类 | 色综合久久久久网| 日韩一级高清毛片| 欧美国产日产图区| 日韩黄色一级片| 9久草视频在线视频精品| 在线电影一区二区三区| 国产偷国产偷亚洲高清人白洁| 中文字幕亚洲不卡| 久久激情五月婷婷| 色一情一乱一乱一91av| 久久青草国产手机看片福利盒子 | 国产精品家庭影院| 美国欧美日韩国产在线播放| 97久久精品人人做人人爽| 精品国产在天天线2019| 亚洲国产成人tv| 成a人片国产精品| 久久久www免费人成精品| 亚洲18影院在线观看| 99国产精品视频免费观看| 欧美v国产在线一区二区三区| 亚洲一区二区三区国产| hitomi一区二区三区精品| 精品久久久影院| 午夜精品福利一区二区三区蜜桃| 波多野结衣中文字幕一区| 久久久噜噜噜久久人人看| 日韩电影免费一区| 欧美日韩三级一区| 亚洲一二三四在线| 日本韩国精品在线| 亚洲久本草在线中文字幕| 成人激情黄色小说| 亚洲国产精品高清| 国产激情一区二区三区| 久久久精品免费免费| 久久国产三级精品| 欧美一级高清片| 麻豆一区二区三区| 欧美一级艳片视频免费观看| 手机精品视频在线观看| 欧美日韩在线直播| 亚洲成人激情综合网| 欧美色视频在线观看| 亚洲国产日韩一区二区| 欧美日韩激情一区二区三区| 亚洲成人综合在线| 91精品国产91久久久久久一区二区| 一区二区三区中文字幕电影|