EDA365电子论坛网

标题: 新手SKIll 解惑, 感谢解答 [打印本页]

作者: zgtsang    时间: 2022-4-5 12:28
标题: 新手SKIll 解惑, 感谢解答
问题:  ( !isDir(sprintf(config_file "%s_shared\\post_process" config_file)) 中,
这个config_file。。。。。。。。。。。config_file    最后的路径是啥? 帮忙贴一下,为啥前后都有config_file变量

完整参考片段:
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
))


作者: db-_-    时间: 2022-4-5 13:29
就跟a=a+1的意思差不多,获取它的值,处理,再赋给它。%s表示printf里面的字符串类型。有点c基础的应该知道%d表示十进制数字。
作者: zgtsang    时间: 2022-4-5 19:42
多谢解惑
作者: zgtsang    时间: 2022-4-5 19:51
zs_king 发表于 2022-04-05 17:39:36
%s 字符串变量   
%d 整数变量
%f 小数变量
%L  List类型的变量
.......
这些在Skill里,进行格式化的时候,经常用到。可以了解下


太感谢了????






欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2