完整参考片段:
procedure( ppra_read_gerber_config()
let( (fin line film_def cmp usage key name mod_inc params layers config_file ret)
ret = nil
; location of shared library files
config_file = getShellEnvVar("ALLEGROLIB_DIR");
; see if environment variable was set
if( !config_file then
axlUIConfirm("[ALLEGROLIB_DIR] environment variable not set!")
; see if shared post-process location exists
else if( !isDir(sprintf(config_file "%s_shared\\post_process" config_file)) then
axlUIConfirm(sprintf(nil "[%s] library directory does not exist!" config_file))
; see if gerber.cfg file exists
else if( !isFile(sprintf(config_file "%s\\gerber.cfg" config_file)) then
axlUIConfirm(sprintf(nil "[%s] does not exist!" config_file))
; open the file
else if( (fin = axlDMOpenFile("TEMP" config_file "r")) == nil then
axlUIConfirm(sprintf(nil "[%s] Cannot open file!" config_file))
else
; read the file
while( (film_def = lineread(fin))
; if film_def = t, then it is a blank line
;if( (film_def != t) && (!nindex(film_def ";")) then
if( film_def != t then
key = nth(0 film_def)
name = substring(key 3) ; remove usage prefix
usage = substring(key 1 1)
mod_inc = nth(1 film_def)
params = nth(2 film_def)
layers = nth(3 film_def)
PPRA_GERBER_FILMS[key] = make_PPRA_FILM_DATA(?usage usage ?name name ?mod_inc mod_inc ?params params ?layers layers)
)
)
axlDMClose(fin)
ret = t
))))
ret
))
作者: zgtsang 时间: 2022-4-5 12:31
另外%s 代表啥? 见笑了,我是小白
完整参考片段:
procedure( ppra_read_gerber_config()
let( (fin line film_def cmp usage key name mod_inc params layers config_file ret)
ret = nil
; location of shared library files
config_file = getShellEnvVar("allegroLIB_DIR");
; see if environment variable was set
if( !config_file then
axlUIConfirm("[ALLEGROLIB_DIR] environment variable not set!")
; see if shared post-process location exists else if( !isDir(sprintf(config_file "%s_shared\\post_process" config_file)) then
axlUIConfirm(sprintf(nil "[%s] library directory does not exist!" config_file))
; see if gerber.cfg file exists
else if( !isFile(sprintf(config_file "%s\\gerber.cfg" config_file)) then
axlUIConfirm(sprintf(nil "[%s] does not exist!" config_file))
; open the file
else if( (fin = axlDMOpenFile("TEMP" config_file "r")) == nil then
axlUIConfirm(sprintf(nil "[%s] Cannot open file!" config_file))
else
; read the file
while( (film_def = lineread(fin))
; if film_def = t, then it is a blank line
;if( (film_def != t) && (!nindex(film_def ";")) then
if( film_def != t then
key = nth(0 film_def)
name = substring(key 3) ; remove usage prefix
usage = substring(key 1 1)
mod_inc = nth(1 film_def)
params = nth(2 film_def)
layers = nth(3 film_def)
PPRA_GERBER_FILMS[key] = make_PPRA_FILM_DATA(?usage usage ?name name ?mod_inc mod_inc ?params params ?layers layers)
)
)
axlDMClose(fin)
ret = t
))))
ret
))