/* Read the cycles and fill in the image array. */ while ( token = readToken() , (parenLevel > 0 || token.type != comma) &&
token.type != semicolon && token.type != eof &&
token.type != rightBracket ) switch( token.type ) { case comma: break; case leftParen: if ( parenLevel == 0 ) {
parenLevel = 1 ;
newCycle = TRUE;
} else
ERROR1s( "readCyclePerm", "Parenthesis error in permutation ",
perm->name, ".") break; case rightParen: if ( parenLevel == 1 && !newCycle ) {
parenLevel = 0 ;
perm->image[previousPt] = firstPtOfCycle;
} else
ERROR1s( "readCyclePerm", "Parenthesis error in permutation ",
perm->name, ".") break; case integer:
pt = token.value.intValue; if ( parenLevel == 1 && pt >= 1 && pt <= degree &&
perm->image[pt] == 0 ) if ( newCycle ) {
firstPtOfCycle = pt;
newCycle = FALSE;
previousPt = pt;
} else {
perm->image[previousPt] = pt;
previousPt = pt;
} else
ERROR1s( "readCyclePerm", "Invalid or repeated point in " "permutation ", perm->name, ".") break; default:
ERROR1s( "readCyclePerm", "Invalid character in permutation ",
perm->name, ".")
}
/* For any points not occuring in cycles, mark the image as the point
itself. */ for ( pt = 1 ; pt <= degree ; ++pt) if ( perm->image[pt] == 0 )
perm->image[pt] = pt;
/* First flag all points as not occuring as images. */ for ( pt = 1 ; pt <= degree ; ++pt )
found[pt] = FALSE;
/* Clear slash and then read in images of points. */
token = readToken(); if ( token.type != slash ) {
ERROR1s( "readImagePerm", "Invalid syntax in image form " "permutation ", perm->name, ".")
}
Permutation *readPerm( constUnsigned degree, /* Degree of permutation to be read. */
PermFormat *const format, /* Set to cycleFormat or imageFormat. */
TokenType *const terminator) /* Set to type of token (comma, semicolon, or eof, or right square bracket) that terminated
the permutation. */
{ Unsigned pt;
Token token, token2;
Permutation *perm;
/* Allocate the permutation. */
perm = allocPermutation();
/* Mark essential field as unknown. */
MAKE_UNKNOWN_ESSENTIAL( perm);
/* Process permutation name if present. */ if ( token = readToken() , token.type == identifier ) if ( token2 = readToken() , token2.type == equal ) {
strncpy( perm->name, token.value.identValue, MAX_NAME_LENGTH+1);
perm->name[MAX_NAME_LENGTH] = '\0';
} else
ERROR1s( "readPerm", "Missing equal sign after name in permutation ",
token.value.identValue, ".") else {
sprintf( perm->name, "%c%u", '_', permNumber++);
unreadToken( token);
}
/* Fill in the degree. */
perm->degree = degree;
/* Allocate the image array, and initially mark all point images as
unknown. Also add trailing 0 to array. */
perm->image = allocIntArrayDegree(); for ( pt = 1 ; pt <= degree+1 ; ++pt )
perm->image[pt] = 0;
/* Check whether permutation is in cycle or image format, and call
appropriate function to finish read. */ switch ( token = readToken() , token.type ) { case leftParen:
unreadToken( token);
*terminator = readCyclePerm( perm);
*format = cycleFormat; break; case slash:
unreadToken( token);
*terminator = readImagePerm( perm);
*format = imageFormat; break; default:
unreadToken( token);
ERROR( "readPerm", "Invalid symbol at start of cycle/image field.");
}
/* Attempt to open library file. */
libFile = fopen( libFileName, "r"); if ( libFile == NULL )
ERROR1s( "readgrp", "File ", libFileName, " could not be opened for input.")
/* Check that group has the required degree, if specified. */ if ( requiredDegree > 0 && G->degree != requiredDegree)
ERROR1s( "readPermGroup", "Group ", G->name, " has incorrect degree.")
/* Initialize the storage manager. */
initializeStorageManager( G->degree);
void writeCyclePerm(
Permutation *s, /* The permutation to write. */ Unsigned startCol1, /* First line starts in this column. */ Unsigned startCol2, /* Remaining lines start in this column. */ Unsigned endCol) /* Lines end by this column. */
{ Unsigned j, pt, img; Unsigned column = startCol1; char *found = allocBooleanArrayDegree();
void writeImagePerm(
Permutation *s, /* The permutation to write. */ Unsigned startCol1, /* First line starts in this column. */ Unsigned startCol2, /* Remaining lines start in this column. */ Unsigned endCol) /* Lines end by this column. */
{ Unsigned i, j; Unsigned column = startCol1;
static BOOLEAN restrictLevel = FALSE; /* Shared with writePermGroupRestricted */ /* Must be reset after each call. */ void writePermGroup( char *libFileName, char *libName,
PermGroup *G, char *comment)
{ Unsigned i, column;
Permutation *gen;
FILE *libFile;
/* Open output file. */
libFile = fopen( libFileName, options.outputFileMode); if ( libFile == NULL )
ERROR1s( "writePermGroup", "File ", libFileName, " could not be opened for append.")
/* Set correct output File. */
setOutputFile( libFile);
/* This function is identical to writePermGroup except that the group G is assumed to stabilize {1,...,restrictedDegree}, and it is written out as a permutation group of degree restrictedDegree. (Note this may reduce the group order.) Also, the group must have the order and base fields filled in, as well as the level field of each
generator. */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.