📄 optlib.tpl
字号:
[= AutoGen5 Template Library -*- Mode: Text -*-# $Id: optlib.tpl,v 1.38 2002/09/10 02:10:57 bkorb Exp $# Automated Options copyright 1992-2002 Bruce Korb=][=IF (getenv "DOCUMENT_USAGE") =][= (define skip-ifdef #t) =][=ELIF (or (exist? "flag.ifdef") (exist? "flag.ifndef")) =][= (define skip-ifdef #f) =][=ELSE =][= (define skip-ifdef #t) =][=ENDIF=][=# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #Emit the "#define SET_OPT_NAME ..." and "#define DISABLE_OPT_NAME ..."=][=DEFINE set_defines set_desc set_index opt_state =]#define SET_[=(. opt-name)=][= IF (exist? "arg_type")=](a)[=ENDIF=] STMTS( \ [=set_desc=].optActualIndex = [=(for-index)=]; \ [=set_desc=].optActualValue = VALUE_[=(. opt-name)=]; \ [=set_desc=].fOptState &= OPTST_PERSISTENT; \ [=set_desc=].fOptState |= [=opt_state=][= IF (exist? "arg_type")=]; \ [=set_desc=].pzLastArg = (char*)(a)[= ENDIF =][= IF (or (exist? "call_proc") (exist? "flag_code") (exist? "extract_code") (exist? "flag_proc") (exist? "arg_range") (exist? "stack_arg") (~* (get "arg_type") "key|num|bool" ) ) =]; \ (*([=(. descriptor)=].pOptProc))( &[= (. pname)=]Options, \ [=(. pname)=]Options.pOptDesc + [=set_index=] )[= ENDIF "callout procedure exists" =] )[= IF (exist? "disable") =]#define DISABLE_[=(. opt-name)=] STMTS( \ [=set_desc=].fOptState &= OPTST_PERSISTENT; \ [=set_desc=].fOptState |= OPTST_SET | OPTST_DISABLED; \ [=set_desc=].pzLastArg = NULL[= IF (or (exist? "call_proc") (exist? "flag_code") (exist? "extract_code") (exist? "flag_proc") (exist? "arg_range") (exist? "stack_arg") ) =]; \ (*([=(. descriptor)=].pOptProc))( &[= (. pname)=]Options, \ [=(. pname)=]Options.pOptDesc + [=set_index=] )[= ENDIF "callout procedure exists" =] )[= ENDIF disable exists =][=ENDDEF=][= # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Emit the copyright comment =][=DEFINE Option_Copyright =][=IF (exist? "copyright") =]/* * [=(sprintf "%s copyright %s %s - all rights reserved" (. prog-name) (get "copyright.date") (get "copyright.owner") ) =][= CASE (get "copyright.type") =][= = gpl =] *[=(gpl (. prog-name) " * " ) =][= = lgpl =] *[=(lgpl (. prog-name) (get "copyright.owner") " * " ) =][= = bsd =] *[=(bsd (. prog-name) (get "copyright.owner") " * " ) =][= = note =] *[=(prefix " * " (get "copyright.text"))=][= * =] * <<indeterminate copyright type>>[= ESAC =] */[=ENDIF "copyright exists" =][=ENDDEF=][=# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #Emit the #define's for a single option=][=DEFINE Option_Defines =][= IF (. skip-ifdef) =][= ELSE =][= IF (exist? "ifdef") =]#ifdef [=(get "ifdef") =][= ELIF (exist? "ifndef") =]#ifndef [=(get "ifndef") =][= ENDIF ifdef/ifndef =][= ENDIF =][= IF (=* (get "arg_type") "key") =]typedef enum {[= IF (not (exist? "arg_default")) =] [= (string-append UP-prefix UP-name)=]_UNDEFINED = 0,[= ENDIF =][=(shellf "for f in %s ; do echo %s_${f} ; done | \ ${COLUMNS_EXE} -I4 --spread=3 --sep=','" (string-upcase! (string->c-name! (join " " (stack "keyword")))) (string-append UP-prefix UP-name) )=]} te_[=(string-append Cap-prefix cap-name)=];[= ENDIF=]#define VALUE_[=(sprintf "%-18s" opt-name)=] [= IF (exist? "value") =][= CASE (get "value") =][= == ' =]'\''[= ~ . =]'[=value=]'[= * =][=(error (sprintf "Error: value for opt %s is `%s'\nmust be single char or 'NUMBER'" (get "name") (get "value")))=][= ESAC =][= ELIF (<= (for-index) 32) =][= (for-index) =][= ELSE =][= (+ (for-index) 96) =][= ENDIF =][= CASE arg_type =][= =* num =]#define [=(. UP-prefix)=]OPT_VALUE_[=(sprintf "%-14s" UP-name) =] (*(long*)(&[=(. UP-prefix)=]OPT_ARG([=(. UP-name)=])))[= =* key =]#define [=(. UP-prefix)=]OPT_VALUE_[=(sprintf "%-14s" UP-name) =] (*(te_[=(string-append Cap-prefix cap-name) =]*)(&[=(. UP-prefix) =]OPT_ARG([=(. UP-name)=])))[= =* bool =]#define [=(. UP-prefix)=]OPT_VALUE_[=(sprintf "%-14s" UP-name) =] (*(ag_bool*)(&[=(. UP-prefix)=]OPT_ARG([=(. UP-name)=])))[= ESAC =][= IF (= (string-upcase! (get "equivalence")) UP-name) =]#define WHICH_[=(sprintf "%-18s" opt-name) =] ([=(. descriptor)=].optActualValue)#define WHICH_[=(. UP-prefix)=]IDX_[=(sprintf "%-14s" UP-name) =] ([=(. descriptor)=].optActualIndex)[= ENDIF =][= IF (exist? "settable") =][= IF (or (not (exist? "equivalence")) (= (get "equivalence") UP-name)) =][= set_defines set_desc = (string-append UP-prefix "DESC(" UP-name ")" ) set_index = (for-index) opt_state = OPTST_SET =][= ELSE "not equivalenced" =][= set_defines set_desc = (string-append UP-prefix "DESC(" (string-upcase! (get "equivalence")) ")" ) set_index = (string-append "INDEX_" UP-prefix "OPT_" (string-upcase! (get "equivalence")) ) opt_state = "OPTST_SET | OPTST_EQUIVALENCE" =][= ENDIF is/not equivalenced =][= ENDIF settable =][= IF (. skip-ifdef) =][= ELSE =][= IF (or (exist? "ifdef") (exist? "ifndef")) =]#endif[= ENDIF =][= ENDIF =][=ENDDEF=][=# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *Define the arrays of values associated with an option (strings, etc.) =][=IF (exist? "preserve-case") =][= (define optname-from "_^") (define optname-to "--") =][=ELSE =][= (define optname-from "A-Z_^") (define optname-to "a-z--") =][=ENDIF =][=DEFINE emit-nondoc-option =][= # # This is *NOT* a documentation option: =]tSCC z[= (sprintf "%-25s" (string-append cap-name "_NAME[]" )) =] = "[=(. UP-name)=]";[= # IF this option can be disabled, # THEN we must create the string for the disabled version # =][= IF (> (len "disable") 0) =]tSCC zNot[= (sprintf "%-23s" (string-append cap-name "_Name[]")) =]= "[= (string-tr! (string-append (get "disable") "-" flg-name) optname-from optname-to) =]";tSCC zNot[= (sprintf "%-23s" (string-append cap-name "_Pfx[]")) =]= "[=(string-downcase! (get "disable"))=]";[= # See if we can use a substring for the option name: # =][= IF (> (len "enable") 0) =]tSCC z[=(sprintf "%-26s" (string-append cap-name "_Name[]")) =]= "[= (string-tr! (string-append (get "enable") "-" flg-name) optname-from optname-to) =]";[= ELSE =]#define z[=(sprintf "%-27s " (string-append cap-name "_Name")) =](zNot[= (. cap-name) =]_Name + [= (+ (string-length (get "disable")) 1 ) =])[= ENDIF =][= ELSE No disablement of this option: =]#define zNot[= (sprintf "%-24s" (string-append cap-name "_Pfx")) =] NULL#define zNot[= (sprintf "%-24s" (string-append cap-name "_Name")) =] NULLtSCC z[= (sprintf "%-26s" (string-append cap-name "_Name[]")) =]= "[= (string-tr! (string-append (if (exist? "enable") (string-append (get "enable") "-") "") (get "name")) optname-from optname-to) =]";[= ENDIF (> (len "disable") 0) =][= # Check for special attributes: a default value # and conflicting or required options =][= IF (exist? "arg_default") =][= CASE arg_type =][= =* num =]#define z[=(sprintf "%-27s " (string-append cap-name "DefaultArg" )) =]((tCC*)[= arg_default =])[= =* bool =][= CASE arg_default =][= ~ n.*|f.*|0 =]#define z[=(sprintf "%-27s " (string-append cap-name "DefaultArg" )) =]((tCC*)AG_FALSE)[= * =]#define z[=(sprintf "%-27s " (string-append cap-name "DefaultArg" )) =]((tCC*)AG_TRUE)[= ESAC =][= =* key =]#define z[=(sprintf "%-27s " (string-append cap-name "DefaultArg" )) =]((tCC*)[=
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -