How to list Context flags

From WeBWorK
(Difference between revisions)
Jump to: navigation, search
(See also)
(Listing Context Flags in an existing WeBWorK question)
Line 440: Line 440:
 
  TEXT(
 
  TEXT(
 
     pp(Context()->{flags})
 
     pp(Context()->{flags})
);
+
);
  
 
*  View the problem
 
*  View the problem
  
 +
 +
* Alternatively you can type
 +
 +
TEXT(
 +
    pretty_print(Context()->{flags})
 +
);
  
 
== See also ==
 
== See also ==

Revision as of 19:49, 16 June 2008

There is an explanation of the purpose of many of these flags at ContextFlags

Listing Context Flags using PGLabs

You can obtain a complete list of contextFlags from one of the current contexts using the PGLabs and this code snippet:

Context("Vector");
TEXT(Context()->{name}, $BR);
TEXT(pretty_print( Context()->{flags} ));

You could also load in one of the customized contexts such as contextCurrency.pl

loadMacros("contextCurrency.pl");
Context("Currency");
Context()->flags->set(trimTrailingZeros=>1);
TEXT(Context()->{name}, $BR);
TEXT(pretty_print( Context()->{flags} ));

which will produce the output below. Notice that the trimTrailingZeros flag has been set to 1 (the default is 0 ).


Currency
HASH(0xc8c1988)

allowBadFunctionInputs

=>

 0

allowBadOperands

=>

 0

allowEmptyStrings

=>

 1

allowMissingFunctionInputs

=>

 0

allowMissingOperands

=>

 0

allowWrongArgCount

=>

 0

checkUndefinedPoints

=>

 0

forceCommas

=>

 0

forceDecimals

=>

 0

formatStudentAnswer

=>

 evaluated

granularity

=>

 1000

ignoreEndpointTypes

=>

 0

ijk

=>

 0

ijkAnyDimension

=>

 1

infiniteWord

=>

 infinity

limits

=>

 ( -2 , 2 , )

max_adapt

=>

 100000000

max_undefined

=>

 

noExtraDecimals

=>

 1

num_points

=>

 5

promoteReals

=>

 1

reduceConstantFunctions

=>

 1

reduceConstants

=>

 1

reduceSets

=>

 1

reduceSetsForComparison

=>

 1

reduceUnions

=>

 1

reduceUnionsForComparison

=>

 1

resolution

=>

 

showExtraParens

=>

 1

tolType

=>

 absolute

tolerance

=>

 0.005

trimTrailingZeros

=>

 0

useBaseTenLog

=>

 0

useFuzzyReals

=>

 1

zeroLevel

=>

 1e-14

zeroLevelTol

=>

 1e-12

Listing Context Flags in an existing WeBWorK question

  • In loadMacros(...); make sure you load "PGinfo.pl", e.g.
loadMacros(
   "PGstandard.pl",
   "PGcourse.pl",
   "~MathObjects.pl",
   "PG.pl"
   "PGinfo.pl",
);

  • Set your Context, e.g.
Context("Your Context Here"); or don't do anything to see flags from the current context
  • Enter the text
TEXT(
    pp(Context()->{flags})
);
  • View the problem


  • Alternatively you can type
TEXT(
    pretty_print(Context()->{flags})
);

See also

follow us