| Customize Help
| Save Settings

MstrSetConstraint



Function Map
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 which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
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
Click to summarizeValue Description
Click to summarize

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.

0 <= Value < M_NUMBER_OF_STRING_MODELS

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
Click to summarizeValue Description
Click to summarize 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)
Click to summarize 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.

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
Click to summarizeValue Description
Click to summarize 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.

(summarize)
Click to summarize M_ANY +

Sets the constraint to any character.

Click to summarize M_DIGIT +

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

Click to summarize M_DIGIT + M_LETTER +

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

Click to summarize 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 values for M_DIGIT + M_LETTER; M_LETTER.

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

function map For specifying the letter case of the constraint
Click to summarizeCombination value Description
Click to summarize M_LOWERCASE

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

Click to summarize M_UPPERCASE

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

Combination value 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
Click to summarizeCombination value Description
Click to summarize

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 < M_NUMBER_OF_FONTS

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 NUMBER OF STRING MODELS DEFAULT DEFAULT ANY DIGIT DIGIT M LETTER LETTER LOWERCASE UPPERCASE NUMBER OF FONTS