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

📄 parseconfig

📁 一个用在mips体系结构中的操作系统
💻
字号:
#!/usr/local/bin/perl5## Copyright (C) 1996-1998 by the Board of Trustees#    of Leland Stanford Junior University.# # This file is part of the SimOS distribution. # See LICENSE file for terms of the license. #if ($ARGV[0]) {    open (CONFIG, $ARGV[0]);} else {    open (CONFIG, "./simconfig.c");}$beginconfig = 0;while (<CONFIG>) {    if(/SimConfigDefaults\(void\)/) {	$beginconfig = 1;    }    if(/^#define\s+(\S+)\s+(\S+)/) {       $defarr{$1} = $2;	   }				    if($beginconfig == 0) {	next;    }    if(/\/\* ENDCONFIG \*\//) {	last;    }    if(/^\s*SimConfigSet(\w+)\s*\(\s*"(\w+)"\s*,\s*(\S+)\s*\)\s*;(\s*\/\*([^*]+)(\*\/)?)?/) {	$tag = join('', $2, ":");	$comment = $5;	$cont = $6;	$token = $1;	if(($1 eq "String") || ($1 eq "Line") || ($1 eq "Bool")) {   	    $3 =~ /"(\S*)"/;	    if($defarr{$1}) {		$defarr{$1} =~ /"(\S*)"/;	    } 	    $val = $1;	} else {	    if($defarr{$3}) {		$val = $defarr{$3};	    } else {		$val = $3;	    }	}	printf "%-25s %-25s#%-6s", $tag, $val, $token;	if($comment) {	    if(!$cont) {		chop $comment;	    }	    printf ": %s\n", $comment;	    while(!($cont) && ($cline = <CONFIG>)) {		if($cline =~ /^\s*(\* )?([^*]*)(\*\/)?/) {		    $cont = $3;		    if($2) {			printf "%51s# %s", "", $2;		    }		}	    }	} else {	    print "\n";	}	next;	          }    if(/\/\*\s*(.+)\s*\*\//) {	print "\n# $1\n";    }}

⌨️ 快捷键说明

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