home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 August
/
Chip_2004-08_cd2.bin
/
prevodniky
/
download
/
VirtualDubMod
/
VirtualDubMod1541CZ.exe
/
VirtualDubMod.chm
/
scripts.js
< prev
next >
Wrap
Text File
|
2003-08-04
|
3KB
|
115 lines
var TAG_FUNCTION = 'function';
var TAG_TYPE = 'type';
var TAG_PARAM = 'param';
var TAG_VERSION = 'version';
document.writeln(" <style type=\"text/css\">");
document.writeln(" <!--");
document.writeln("." + TAG_FUNCTION + " { color: #A00000; font-weight: bold }");
document.writeln("." + TAG_TYPE + " { color: #0000A0; font-weight: bold }");
document.writeln("." + TAG_PARAM + " { color: #404040; font-weight: bold }");
document.writeln("." + TAG_VERSION + " { color: #FF0000; font-weight: normal; background-color: #FFFF00 }");
document.writeln(" -->");
document.writeln(" </style>");
function trim(s) {
start = 0;
end = s.length;
while( (start<end) && (s.charAt(start)==' ') )
start++;
while( (start<end) && (s.charAt(end-1)==' ') )
end--;
return s.substring(start, end);
}
function format_tagged_value(tag_name, value) {
return "<span class='" + tag_name + "'>" + value + "</span>";
}
function format_function(fnct) {
return format_tagged_value(TAG_FUNCTION, fnct);
}
function format_param_type(param_type) {
return format_tagged_value(TAG_TYPE, param_type);
}
function format_param_name(param_name) {
return format_tagged_value(TAG_PARAM, param_name);
}
function format_version(ver) {
return format_tagged_value(TAG_VERSION, ver);
}
function open_list() {
document.writeln('<ul style=\"margin-top: 0;margin-bottom: 5;margin-left: 15\">');
}
function close_list() {
document.writeln('</ul>');
}
function add_function(name, params, desc, need_version) {
params = trim(params);
_params = '';
_type = '';
_param = '';
index = 0;
param_start = 0;
param_end = 0;
end = params.length;
while(true) {
if( (index>=end) || (params.charAt(index)==',') ) {
if(index == param_start)
break;
i = param_start;
while( (i<end) && (params.charAt(i)==' ') )
i++;
param_start = i;
i = index-1;
while( (i>param_start) && (params.charAt(i)==' ') )
i--;
param_end = i;
while( (i>param_start) && (params.charAt(i)!=' ') )
i--;
if(i != param_start) {
_param = params.substring(i+1, param_end+1);
while( (i>=param_start) && (params.charAt(i)==' ') )
i--;
_type = params.substring(param_start, i+1);
} else
_type = params.substring(param_start, param_end+1);
if( (_type && !_param) || (!_type && _param) ) {
alert('Warning : bad parameter given in function [' + name + '] (type=[' + _type + '], name=[' + _param + '])');
_params += format_param_type(_type) + format_param_name(_param);
} else
_params += format_param_type(_type) + ' ' + format_param_name(_param);
if(index>=end)
break;
_params += ', '
_type = '';
_param = '';
param_start = index + 1;
}
index++;
}
_function = name + '(' + _params + ')';
document.write('<li><code>' + format_function(_function) + '</code>');
if(need_version)
document.write('<sup>' + format_version(need_version) + '</sup>');
if(desc)
document.write('<br />\n' + desc);
document.writeln('</li>');
}