| MIL 10 Reference
| Customize Help
| Save Settings

MstrSetConstraint



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Set character constraints.
Syntax
void MstrSetConstraint(
MIL_ID ContextId, //in
MIL_INT StringIndex, //in
MIL_INT CharPos, //in
MIL_INT64 ConstraintType, //in
const void *CharListPtr //in
)
Description

This function specifies the constraint to apply to a specified character of a specified string or of all strings.

Each constraint must include at least one character existing in one of the selected fonts. For example, if the constraint is M_DIGIT then at least one of the fonts must contain a digit.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
ContextId

Specifies the String Reader context with which to associate the constraint. The String Reader context must have been previously allocated on the required system using MstrAlloc().

StringIndex

Specifies the string(s) in the String Reader context to affect.

Note that a new string can be added to the String Reader context using MstrControl() with M_STRING_ADD.

This parameter should be set to the following value:

function map For specifying the string index
CollapseValue Description
Collapse

Specifies that the constraint will be applied to a string or to all strings.

(summarize)
Parameters

This parameter specifies the index of the string. You can set this parameter to one of the following:

M_ALL

Specifies that the constraint will be applied to all strings.

Value >= 0

Specifies the index of the individual string to which the constraint will be applied.

CharPos

Specifies the character position in the string for which to set the constraint.

A constraint can be set for any position, even a position greater than the maximum number of characters in the string. Constraints set at a position greater than the minimum number of characters in the string are ignored (when the string read does not contain a character at that position).

This parameter should be set to one of the following values:

function map For specifying the character position
CollapseValue Description
Collapse M_DEFAULT

Sets the default constraint of the string model.

The default constraint of the string model is used when no specific constraint is set to a given position.

(summarize)
Collapse 0 <= Value <= 255

Sets the character position in the string to which to apply the constraint.

ConstraintType INQ

Specifies the type of constraint to set. Unless otherwise specified, the constants listed below can be added together.

By default, all constraints apply to any font in the context. For example, M_LETTER + M_DIGIT means any letter and any digit of any font is acceptable. To restrict the constraint to a specific font, see the combination value below.

function map For specifying the constraint
CollapseValue Description
Collapse M_DEFAULT

Sets the constraint to the default constraint.

For a specific character position (the CharPos parameter is set to an individual value), the default is the same as the default constraint of the string model.

For the default character position (the CharPos parameter is set to M_DEFAULT), the default is the same as M_ANY.

With the exception of combination values, M_DEFAULT cannot be added to any other constraints.

(summarize)
Collapse M_ANY +

Sets the constraint to any character.

With the exception of combination values, M_ANY cannot be added to any other constraints.

(summarize)
Collapse M_DIGIT +

Sets the constraint to any digit (0 to 9).

Collapse M_LETTER +

Sets the constraint to any letter (a to z and A to Z).

Note that M_LETTER does not differentiate between upper and lower cases.

(summarize)
Combination constants for M_LETTER.

You can add one of the following values to the above-mentioned value to set the letter case of the constraint.

function map For specifying the letter case of the constraint
CollapseCombination value Description
Collapse M_LOWERCASE

Sets the constraint to any lowercase letter (a to z).

Collapse M_UPPERCASE

Sets the constraint to any uppercase letter (A to Z).

Combination constant for the values listed in For specifying the constraint.

You can add the following value to the above-mentioned values to set the constraint to a specific font.

function map For restricting the constraint
CollapseCombination value Description
Collapse

Specifies that the constraint will be restricted to a specific font.

Note that this value is only available for a font-based context.

(summarize)
Parameters

This parameter specifies the index of the font. You can set this parameter to one of the following:

0 <= Value <= 255

Specifies the index of the individual font from which the constraint is taken.

When setting the constraint, the font index can be the index of a font that does not currently exist. However, if the font still does not exist at preprocessing time, an error will be logged.

CharListPtr INQ

Specifies an explicit list of valid characters, at the specified position. This is an optional, null-terminated string.

All the specified characters must be compatible with the ConstraintType parameter definition. Each character in the character list must be unique; no character repetition is allowed in the CharListPtr parameter.

The string array must be of the right type for the encoding scheme selected (MstrInquire() with M_ENCODING).

Set this parameter to M_NULL if you are not specifying an explicit list.

Compilation information
Header Include mil.h.
Library Use mil.lib; milstr.lib.
DLL Requires mil.dll; milstr.dll.
ALL DEFAULT DEFAULT ANY DIGIT LETTER LOWERCASE UPPERCASE