static herr_t
_saf_gen_stdtypes(ss_file_t *stdtypes)
{
SAF_ENTER(_saf_gen_stdtypes, -1);
ss_scope_t stdscope;
int i;
/* WARNING: SEE COMMENTS IN PROLOGUE. DO NOT CHANGE THE ORDER OF, OR DELETE OBJECTS DEFINED HERE BECAUSE EXISTING FILES
* MAY BE POINTING INTO THE BUILT-IN REGISTRY AND DO NOT EXPECT IT TO CHANGE OVER TIME. ONLY ADD NEW OBJECTS. */
if (NULL==ss_file_topscope(stdtypes, &stdscope))
SAF_ERROR(-1, _saf_errmsg("cannot find top scope for built-in registry file"));
/* Create "not applicable" objects and cache them in global variables. By convention, a "not applicable" object is simply
* what gets created by SS_PERS_NEW() by default. */
ss_pers_new(&stdscope, SS_MAGIC(ss_field_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_FIELD_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_role_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_ROLE_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_basis_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_BASIS_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_algebraic_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_ALGEBRAIC_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_evaluation_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_EVALUATION_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_relrep_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_RELREP_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_quantity_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_QUANTITY_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_unit_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_UNIT_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_cat_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_CAT_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_set_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_SET_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_collection_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_COLLECTION_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_rel_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_REL_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_tops_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_TOPS_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_blob_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_BLOB_g, NULL);
ss_pers_new(&stdscope, SS_MAGIC(ss_indexspec_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_NOT_APPLICABLE_INDEXSPEC_g, NULL);
/* The seven basic quantities */
_SAF_GLOBALS.quant[SAF_BASEQ_TIME] = saf_declare_quantity(SAF_ALL, stdtypes,
"time", NULL, "builtin", NULL);
_SAF_GLOBALS.quant[SAF_BASEQ_MASS] = saf_declare_quantity(SAF_ALL, stdtypes,
"mass", NULL, "builtin", NULL);
_SAF_GLOBALS.quant[SAF_BASEQ_CURRENT] = saf_declare_quantity(SAF_ALL, stdtypes,
"electric current", "current", "builtin", NULL);
_SAF_GLOBALS.quant[SAF_BASEQ_LENGTH] = saf_declare_quantity(SAF_ALL, stdtypes,
"length", NULL, "builtin", NULL);
_SAF_GLOBALS.quant[SAF_BASEQ_LIGHT] = saf_declare_quantity(SAF_ALL, stdtypes,
"luminous intensity", "light", "builtin", NULL);
_SAF_GLOBALS.quant[SAF_BASEQ_TEMP] = saf_declare_quantity(SAF_ALL, stdtypes,
"thermodynamic temperature", "temperature", "builtin", NULL);
_SAF_GLOBALS.quant[SAF_BASEQ_AMOUNT] = saf_declare_quantity(SAF_ALL, stdtypes,
"amount of a substance", "amount", "builtin", NULL);
for (i=0; i<SS_MAX_BASEQS; i++) {
SAF_DIRTY(_SAF_GLOBALS.quant[i], SAF_ALL);
SS_QUANTITY(_SAF_GLOBALS.quant[i])->power[i] = 1;
}
/* Additional things */
ss_pers_new(&stdscope, SS_MAGIC(ss_set_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_UNIVERSE_SET_g, NULL);
ss_string_set(SS_SET_P(&SAF_UNIVERSE_SET_g,name), "universe");
ss_pers_new(&stdscope, SS_MAGIC(ss_cat_t), NULL, SS_ALLSAME, (ss_pers_t*)&SAF_SELF_CAT_g, NULL);
ss_string_set(SS_CAT_P(&SAF_SELF_CAT_g,name), "self");
SAF_LEAVE(0);
}