/**************************************************************************** ** *FRNamName(<name>)............convertanametoarecordname ** **'RNamName'returnstherecordnamewiththename<name>(whichisaC **string).
*/
UInt RNamName(constChar * name)
{
UInt len = strlen(name); if (len > 1023) { // Note: We can't pass 'name' here, as it might get moved by garbage collection
ErrorQuit("Record names must consist of at most 1023 characters", 0, 0);
}
return LookupSymbol(&RNamSymbolTable, name);
}
/**************************************************************************** ** *FRNamIntg(<intg>)..........convertanintegertoarecordname ** **'RNamIntg'returnstherecordnamecorrespondingtotheinteger<intg>.
*/
UInt RNamIntg ( Int intg )
{ Char name [32]; // integer converted to a string Char * p; // loop variable
UInt negative;
// convert the integer to a string
p = name + sizeof(name); *--p = '\0';
negative = (intg < 0); if ( negative ) {
intg = -intg;
}
next = 0; for ( i = 1; i <= countRNam; i++ ) {
curr = CONST_CSTR_STRING( NAME_RNAM( i ) ); for ( k = 0; name[k] != 0 && curr[k] == name[k]; k++ ) ; if ( k < len || curr[k] <= name[k] ) continue; if ( next != 0 ) { for ( k = 0; curr[k] != '\0' && curr[k] == next[k]; k++ ) ; if ( k < len || next[k] < curr[k] ) continue;
}
next = curr;
}
if ( next != 0 ) { for ( k = 0; next[k] != '\0'; k++ )
name[k] = next[k];
name[k] = '\0';
}
copy = NEW_PLIST_IMM( T_PLIST, countRNam ); for ( i = 1; i <= countRNam; i++ ) {
name = NAME_RNAM( i );
s = CopyToStringRep(name);
SET_ELM_PLIST( copy, i, s );
}
SET_LEN_PLIST( copy, countRNam ); return copy;
}
// register global bags with the garbage collector
InitGlobalBag( &NamesRNam, "src/records.c:NamesRNam" );
// make the hash list of record names
InitSymbolTableKernel(&RNamSymbolTable, "src/records.c:RNamSymbolCount", "src/records.c:RNamSymbolTable", NAME_RNAM,
NewRNamCallback);
// make and install the 'IS_REC' filter for ( type = FIRST_REAL_TNUM; type <= LAST_REAL_TNUM; type++ ) {
assert(IsRecFuncs[ type ] == 0);
IsRecFuncs[ type ] = AlwaysNo;
} for ( type = FIRST_RECORD_TNUM; type <= LAST_RECORD_TNUM; type++ ) {
IsRecFuncs[ type ] = AlwaysYes;
} for ( type = FIRST_EXTERNAL_TNUM; type <= LAST_EXTERNAL_TNUM; type++ ) {
IsRecFuncs[ type ] = IsRecObject;
}
// make and install the 'ELM_REC' operations for ( type = FIRST_REAL_TNUM; type <= LAST_REAL_TNUM; type++ ) {
assert(ElmRecFuncs[ type ] == 0);
ElmRecFuncs[ type ] = ElmRecError;
} for ( type = FIRST_EXTERNAL_TNUM; type <= LAST_EXTERNAL_TNUM; type++ ) {
ElmRecFuncs[ type ] = ElmRecObject;
}
// make and install the 'ISB_REC' operation for ( type = FIRST_REAL_TNUM; type <= LAST_REAL_TNUM; type++ ) {
assert(IsbRecFuncs[ type ] == 0);
IsbRecFuncs[ type ] = IsbRecError;
} for ( type = FIRST_EXTERNAL_TNUM; type <= LAST_EXTERNAL_TNUM; type++ ) {
IsbRecFuncs[ type ] = IsbRecObject;
}
// make and install the 'ASS_REC' operation for ( type = FIRST_REAL_TNUM; type <= LAST_REAL_TNUM; type++ ) {
assert(AssRecFuncs[ type ] == 0);
AssRecFuncs[ type ] = AssRecError;
} for ( type = FIRST_EXTERNAL_TNUM; type <= LAST_EXTERNAL_TNUM; type++ ) {
AssRecFuncs[ type ] = AssRecObject;
}
// make and install the 'UNB_REC' operation for ( type = FIRST_REAL_TNUM; type <= LAST_REAL_TNUM; type++ ) {
assert(UnbRecFuncs[ type ] == 0);
UnbRecFuncs[ type ] = UnbRecError;
} for ( type = FIRST_EXTERNAL_TNUM; type <= LAST_EXTERNAL_TNUM; type++ ) {
UnbRecFuncs[ type ] = UnbRecObject;
}
/**************************************************************************** ** *FInitInfoRecords()................tableofinitfunctions
*/ static StructInitInfo module = { // init struct using C99 designated initializers; for a full list of // fields, please refer to the definition of StructInitInfo
.type = MODULE_BUILTIN,
.name = "records",
.initKernel = InitKernel,
.initLibrary = InitLibrary,
};
¤ 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.0.30Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
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.