- 积分
- 20474
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-2-16
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 lleoiu 于 2015-4-8 10:44 编辑
在NCL的官网上提供了编辑器的着色文件,并且提供了自动从NCL官网获取全部keywords, function, resources
的子程序gen_editor_utils.ncl。
在使用这个函数时,发现一个问题,get_ncl_resources(),get_ncl_keywords() ,get_ncl_operators()这几个函数都可以正常工作,但是 get_ncl_procs_and_funcs(), get_ncl_procs_and_funcs_by_cat()运行得到的结果会出现如下的情况:
cfftf_frq_reorder
cfftf
Functions
Functions
charactertodouble
Built-in
charactertofloat
Built-in
charactertointeger
Built-in
charactertolong
Built-in
charactertoshort
Built-in
charactertostring
Built-in
chartodouble
Built-in
chartofloat
Built-in
chartoint
Built-in
chartointeger
Built-in
chartolong
Built-in
chartoshort
Built-in
chartostring
Built-in
chiinv
就是在部分函数下,会出现Built-in, 或者Functions这样的字符,但这肯定不是NCL的函数名。
看了原代码,在line_search = "<a href=" + dq + names(icat,2)这里折腾了很久也没有搞定。
请教各位,如何在页面上挑选函数时把筛选的条件定的更严格一些?
;----------------------------------------------------------------------
; This function reads the alphabetical web page for the given category
; type of NCL functions and procedures and produces a list of the
; names. Use "get_ncl_procs_and_funcs" if you just want one giant
; list of function/procedure names, regardless of category.
;----------------------------------------------------------------------
undef("get_ncl_procs_and_funcs_by_cat")
function get_ncl_procs_and_funcs_by_cat(cat_name)
local url, fname, lines, dq, line_search, new_lines, delim, ii
begin
fname = "list_alpha_browse.shtml"
if(GET_FROM_WEB) then
;---Remove local file first.
system("/bin/rm " + fname)
url = "http://www.ncl.ucar.edu/Document/Functions/"
system("wget " + (url+fname))
end if
names = get_valid_cat_names()
lines = asciiread(fname,-1,"string")
;
; Get just the strings that contain the func/proc names for
; the given category.
;
; The line we want contains:
;
; <a href="/Document/XXXXX/YYYY/funcproc_name.shtml"...
;
icat = ind(cat_name.eq.names(:,0))
if(ismissing(icat)) then
print("get_ncl_procs_and_funcs_by_cat: invalid category")
return(new(1,string))
end if
;;;;This part still needs work!!
dq = str_get_dq()
line_search = "<a href=" + dq + names(icat,2)
ii = str_match_ind(lines,line_search)
new_lines = lines(ii)
;---Split out the function/procedure names
delim = "/."
fnames = str_get_field(new_lines,5,delim)
return(fnames)
end
|
|