?? bjam.qbk
字號:
Defined only for win32 platform. It reads the registry of Windows. '/path/' is the location of the information, and '/result-type/' is either '=subkeys=' or '=values='. For more information on '/path/' format and constraints, please see =W32_GETREG=.Depending on '/result-type/', the rule returns one of the following:[variablelist [[=subkeys=] [Names of all direct subkeys of '/path/'.]] [[=values=] [Names of values contained in registry key given by '/path/'. The "default" value of the key appears in the returned list only if its value has been set in the registry.]]]If '/result-type/' is not recognized, or requested data cannot be retrieved, the rule returns an empty list.Example:[pre local key = "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\App Paths" ;local subkeys = \[ W32_GETREGNAMES "$(key)" : subkeys \] ;for local subkey in $(subkeys){ local values = \[ W32_GETREGNAMES "$(key)\\\\$(subkey)" : values \] ; for local value in $(values) { local data = \[ W32_GETREG "$(key)\\\\$(subkey)" : "$(value)" \] ; ECHO "Registry path: " $(key)\\\\$(subkey) ":" $(value) "=" $(data) ; }}][endsect][section =SHELL= ][prerule SHELL ( /command/ : * )]=SHELL= executes /command/, and then returns the standard output of /command/. =SHELL= only works on platforms with a =popen()= function in the C library. On platforms without a working =popen()= function, =SHELL= is implemented as a no-op. =SHELL= works on Unix, MacOS X, and most Windows compilers. =SHELL= is a no-op on Metrowerks compilers under Windows. There is a variable set of allowed options as additional arguments:[variablelist [[=exit-status=] [In addition to the output the result status of the executed command is returned as a second element of the result.]] [[=no-output=] [Don't capture the output of the command. Instead an empty ("") string value is returned in place of the output.]]]Because the Perforce/Jambase defines a =SHELL= rule which hides thebuiltin rule, =COMMAND= can be used as an alias for =SHELL= in such a case.[endsect][endsect][endsect][endsect][section Flow-of-Control]=BJam= has several simple flow-of-control statements:[prefor /var/ in /list/ { /statements/ }]Executes /statements/ for each element in /list/, setting the variable /var/ to the element value.[preif /cond/ { /statements/ }\[ else { /statements/ } \]]Does the obvious; the =else= clause is optional. /cond/ is built of:[variablelist[[[^['a]]] [true if any ['a] element is a non-zero-length string]][[[^['a] = ['b]]] [list ['a] matches list ['b] string-for-string]][[[^['a] != ['b]]] [list ['a] does not match list ['b]]][[[^['a] < ['b]]] [['a\[i\]] string is less than ['b\[i\]] string, where ['i] is first mismatched element in lists ['a] and ['b]]][[[^['a] <= ['b]]] [every ['a] string is less than or equal to its ['b] counterpart]][[[^['a] > ['b]]] [['a\[i\]] string is greater than ['b\[i\]] string, where ['i] is first mismatched element]][[[^['a] >= ['b]]] [every ['a] string is greater than or equal to its ['b] counterpart]][[[^['a] in ['b]]] [true if all elements of ['a] can be found in ['b], or if ['a] has no elements]][[[^! ['cond]]] [condition not true]][[[^['cond] && ['cond]]] [conjunction]][[[^['cond] || ['cond]]] [disjunction]][[[^( ['cond] )]] [precedence grouping]]][preinclude /file/ ;]Causes =bjam= to read the named /file/. The /file/ is bound like a regular target (see Binding above) but unlike a regular target the include /file/ cannot be built.The include /file/ is inserted into the input stream during the parsing phase. The primary input file and all the included file(s) are treated as a single file; that is, jam infers no scope boundaries from included files.[prelocal /vars/ \[ = /values/ \] ;]Creates new /vars/ inside to the enclosing ={}= block, obscuring any previous values they might have. The previous values for vars are restored when the current block ends. Any rule called or file included will see the local and not the previous value (this is sometimes called Dynamic Scoping). The local statement may appear anywhere, even outside of a block (in which case the previous value is restored when the input ends). The /vars/ are initialized to /values/ if present, or left uninitialized otherwise.[prereturn /values/ ;]Within a rule body, the return statement sets the return value for an invocation of the rule. It does *not* cause the rule to return; a rule's value is actually the value of the last statement executed, so a return should be the last statement executed before the rule "naturally" returns.[preswitch /value/{ case /pattern1/ : /statements/ ; case /pattern2/ : /statements/ ; ...}]The switch statement executes zero or one of the enclosed /statements/, depending on which, if any, is the first case whose /pattern/ matches /value/. The /pattern/ values are not variable-expanded. The pattern values may include the following wildcards:[variablelist[[[^?]] [match any single character]][[[^*]] [match zero or more characters]][[[^\[/chars/\]]] [match any single character in /chars/]][[[^\[\^/chars/\]]] [match any single character not in /chars/]][[[^\\/x/]] [match /x/ (escapes the other wildcards)]]][prewhile /cond/ { /statements/ }]Repeatedly execute /statements/ while /cond/ remains true upon entry. (See the description of /cond/ expression syntax under if, above). [endsect][section Variables]=BJam= variables are lists of zero or more elements, with each element being a string value. An undefined variable is indistinguishable from a variable with an empty list, however, a defined variable may have one more elements which are null strings. All variables are referenced as [^$(/variable/)].Variables are either global or target-specific. In the latter case, the variable takes on the given value only during the updating of the specific target.A variable is defined with:[pre/variable/ = /elements/ ;/variable/ += /elements/ ;/variable/ on /targets/ = /elements/ ;/variable/ on /targets/ += /elements/ ;/variable/ default = /elements/ ;/variable/ ?= /elements/ ;]The first two forms set /variable/ globally. The third and forth forms set a target-specific variable. The [^\=] operator replaces any previous elements of /variable/ with /elements/; the [^+=] operation adds /elements/ to /variable/'s list of elements. The final two forms are synonymous: they set /variable/ globally, but only if it was previously unset.Variables referenced in updating commands will be replaced with their values; target-specific values take precedence over global values. Variables passed as arguments (=$(1)= and =$(2)=) to actions are replaced with their bound values; the "=bind=" modifier can be used on actions to cause other variables to be replaced with bound values. See Action Modifiers above.=BJam= variables are not re-exported to the environment of the shell that executes the updating actions, but the updating actions can reference =bjam= variables with [^$(/variable/)]. [section:expansion Variable Expansion]During parsing, =bjam= performs variable expansion on each token that is not a keyword or rule name. Such tokens with embedded variable references are replaced with zero or more tokens. Variable references are of the form [^$(/v/)] or [^$(/vm/)], where ['v] is the variable name, and ['m] are optional modifiers.Variable expansion in a rule's actions is similar to variable expansion in statements, except that the action string is tokenized at whitespace regardless of quoting.The result of a token after variable expansion is the /product/ of the components of the token, where each component is a literal substring or a list substituting a variable reference. For example:[pre$(X) -> a b ct$(X) -> ta tb tc$(X)z -> az bz cz$(X)-$(X) -> a-a a-b a-c b-a b-b b-c c-a c-b c-c]The variable name and modifiers can themselves contain a variable reference, and this partakes of the product as well:[pre$(X) -> a b c$(Y) -> 1 2$(Z) -> X Y$($(Z)) -> a b c 1 2]Because of this product expansion, if any variable reference in a token is undefined, the result of the expansion is an empty list. If any variable element is a null string, the result propagates the non-null elements:[pre$(X) -> a ""$(Y) -> "" 1$(Z) ->-$(X)$(Y)- -> -a- -a1- -- -1--$(X)$(Z)- ->]A variable element's string value can be parsed into grist and filename-related components. Modifiers to a variable are used to select elements, select components, and replace components. The modifiers are:[variablelist[[[^\[['n]\]]] [Select element number ['n] (starting at 1). If the variable contains fewer than ['n] elements, the result is a zero-element list. ['n] can be negative in which case the element number ['n] from the last leftward is returned.]][[[^\[['n]-['m]\]]] [Select elements number ['n] through ['m]. ['n] and ['m] can be negative in which case they refer to elements counting from the last leftward.]][[[^\[['n]-\]]] [Select elements number ['n] through the last. ['n] can be negative in which case it refers to the element counting from the last leftward.]][[[^:B]] [Select filename base.]][[[^:S]] [Select (last) filename suffix.]][[[^:M]] [Select archive member name.]][[[^:D]] [Select directory path.]][[[^:P]] [Select parent directory.]][[[^:G]] [Select grist.]][[[^:U]] [Replace lowercase characters with uppercase.]][[[^:L]] [Replace uppercase characters with lowercase.]][[[^:W]] [When invoking Windows-based tools from [@http://www.cygwin.com/ Cygwin] it can be important to pass them true windows-style paths. The =:W= modifier, *under Cygwin only*, turns a cygwin path into a Win32 path using the [@http://www.cygwin.com/cygwin-api/func-cygwin-conv-to-win32-path.html =cygwin_conv_to_win32_path=] function. On other platforms, the string is unchanged. For example`` x = "/cygdrive/c/Program Files/Borland" ; ECHO $(x:W) ;``prints [^"C:\\Program Files\\Borland"] on Cygwin]][[[^:['chars]]] [Select the components listed in ['chars].]][[[^:G=['grist]]] [Replace grist with ['grist].]][[[^:D=['path]]] [Replace directory with ['path].]][[[^:B=['base]]] [Replace the base part of file name with ['base].]][[[^:S=['suf]]] [Replace the suffix of file name with ['suf].]][[[^:M=['mem]]] [Replace the archive member name with ['mem].]][[[^:R=['root]]] [Prepend ['root] to the whole file name, if not already rooted.]][[[^:E=['value]]] [Assign ['value] to the variable if it is unset.]][[[^:J=['joinval]]] [Concatentate list elements into single element, separated by ['joinval]'.]]]On VMS, [^$(var:P)] is the parent directory of [^$(var:D)].[endsect][section Local For Loop Variables]Boost Jam allows you to declare a local for loop control variable right in the loop:[prex = 1 2 3 ;y = 4 5 6 ;for *local* y in $(x){ ECHO $(y) ; # prints "1", "2", or "3"}ECHO $(y) ; # prints "4 5 6"][endsect][section:atfile Generated File Expansion]During expansion of expressions =bjam= also looks for subexpressions of the form=@(filename:E=filecontents)= and replaces the expression with =filename= aftercreating the given file with the contents set to =filecontents=. This is useful
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -