📄 objcmp.c
字号:
"SLOT_DESC",SlotPrefix(),
*reopenSlotFile,slotCodeFile);
if (*slotFile == NULL)
return(FALSE);
for (i = 0 ; i < theDefclass->slotCount ; i++)
{
sd = &theDefclass->slots[i];
if (i > 0)
fprintf(*slotFile,",\n");
fprintf(*slotFile,"{ %u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,",
sd->shared,sd->multiple,
sd->composite,sd->noInherit,
sd->noWrite,sd->initializeOnly,
sd->dynamicDefault,sd->defaultSpecified,
sd->noDefault,sd->reactive,
sd->publicVisibility,sd->createReadAccessor,
sd->createWriteAccessor,sd->overrideMessageSpecified);
PrintClassReference(theEnv,*slotFile,sd->cls,imageID,maxIndices);
fprintf(*slotFile,",");
PrintSlotNameReference(theEnv,*slotFile,sd->slotName,imageID,maxIndices);
fprintf(*slotFile,",\n ");
PrintSymbolReference(theEnv,*slotFile,sd->overrideMessage);
if (sd->defaultValue != NULL)
{
fprintf(*slotFile,",(void *) ");
if (sd->dynamicDefault)
ExpressionToCode(theEnv,*slotFile,(EXPRESSION *) sd->defaultValue);
else
{
tmpexp = ConvertValueToExpression(theEnv,(DATA_OBJECT *) sd->defaultValue);
ExpressionToCode(theEnv,*slotFile,tmpexp);
ReturnExpression(theEnv,tmpexp);
}
}
else
fprintf(*slotFile,",NULL");
fprintf(*slotFile,",");
PrintConstraintReference(theEnv,*slotFile,sd->constraint,imageID,maxIndices);
fprintf(*slotFile,",0,0L,");
if (sd->shared)
{
theLocationInfo.theLong = sd->sharedValue.desc->bsaveIndex;
fprintf(*slotFile,"{ &%s%d_%u[%u],0,0,0,NULL } }",
SlotPrefix(),imageID,
theLocationInfo.theLocation.thePartition,
theLocationInfo.theLocation.theOffset);
}
else
fprintf(*slotFile,"{ NULL,0,0,0,NULL } }");
}
*slotArrayCount += (int) theDefclass->slotCount;
*slotFile = CloseFileIfNeeded(theEnv,*slotFile,slotArrayCount,
slotArrayVersion,maxIndices,
reopenSlotFile,slotCodeFile);
return(TRUE);
}
/*************************************************************
NAME : TemplateSlotsToCode
DESCRIPTION : Prints out instance template -
the entire instance slot template
for a particular class is
guaranteed to be in the same
array partition
INPUTS : 1) A buffer for the template file
2) The base image name
3) The id for this type of data
4) The base image id
5) The general header file
6) A buffer for the version number of
the file for this type of data
7) The maximum # of elements in any array
8) A pointer to the class
9) A buffer holding the template partition #
10) A buffer holding the template relative
index in the partition
11) A buffer for a flag indicating if the
buffer file can be reopened later
12) A pointer to the file info for
this data if the last file needs
to be reopened for termination
RETURNS : TRUE if all OK, FALSE
otherwise
SIDE EFFECTS : Templates written
NOTES : None
*************************************************************/
static intBool TemplateSlotsToCode(
void *theEnv,
FILE **templateSlotFile,
char *fileName,
int fileID,
int imageID,
FILE *headerFP,
int *fileCount,
int maxIndices,
DEFCLASS *theDefclass,
int *templateSlotArrayVersion,
int *templateSlotArrayCount,
int *reopenTemplateSlotFile,
struct CodeGeneratorFile *templateSlotCodeFile)
{
register unsigned i;
SLOT_DESC *sd;
PACKED_LOCATION_INFO theLocationInfo;
if (theDefclass->instanceSlotCount == 0)
return(TRUE);
*templateSlotFile = OpenFileIfNeeded(theEnv,*templateSlotFile,fileName,fileID,
imageID,fileCount,
*templateSlotArrayVersion,headerFP,
"SLOT_DESC *",TemplateSlotPrefix(),
*reopenTemplateSlotFile,templateSlotCodeFile);
if (*templateSlotFile == NULL)
return(FALSE);
for (i = 0 ; i < theDefclass->instanceSlotCount ; i++)
{
sd = theDefclass->instanceTemplate[i];
if (i > 0)
fprintf(*templateSlotFile,",");
theLocationInfo.theLong = sd->bsaveIndex;
fprintf(*templateSlotFile,"&%s%d_%u[%u]",
SlotPrefix(),imageID,
theLocationInfo.theLocation.thePartition,
theLocationInfo.theLocation.theOffset);
}
*templateSlotArrayCount += (int) theDefclass->instanceSlotCount;
*templateSlotFile = CloseFileIfNeeded(theEnv,*templateSlotFile,templateSlotArrayCount,
templateSlotArrayVersion,maxIndices,
reopenTemplateSlotFile,templateSlotCodeFile);
return(TRUE);
}
/*************************************************************
NAME : OrderedSlotsToCode
DESCRIPTION : Prints out slot name map -
the entire slot name map
for a particular class is
guaranteed to be in the same
array partition
INPUTS : 1) A buffer for the slot map file
2) The base image name
3) The id for this type of data
4) The base image id
5) The general header file
6) A buffer for the version number of
the file for this type of data
7) The maximum # of elements in any array
8) A pointer to the class
9) A buffer holding the slot map partition #
10) A buffer holding the slot map relative
index in the partition
11) A buffer for a flag indicating if the
buffer file can be reopened later
12) A pointer to the file info for
this data if the last file needs
to be reopened for termination
RETURNS : TRUE if all OK, FALSE
otherwise
SIDE EFFECTS : Slot maps written
NOTES : None
*************************************************************/
static intBool OrderedSlotsToCode(
void *theEnv,
FILE **orderedSlotFile,
char *fileName,
int fileID,
int imageID,
FILE *headerFP,
int *fileCount,
int maxIndices,
DEFCLASS *theDefclass,
int *orderedSlotArrayVersion,
int *orderedSlotArrayCount,
int *reopenOrderedSlotFile,
struct CodeGeneratorFile *orderedSlotCodeFile)
{
register unsigned i;
if (theDefclass->instanceSlotCount == 0)
return(TRUE);
*orderedSlotFile = OpenFileIfNeeded(theEnv,*orderedSlotFile,fileName,fileID,
imageID,fileCount,
*orderedSlotArrayVersion,headerFP,
"unsigned",OrderedSlotPrefix(),
*reopenOrderedSlotFile,orderedSlotCodeFile);
if (*orderedSlotFile == NULL)
return(FALSE);
for (i = 0 ; i <= theDefclass->maxSlotNameID ; i++)
{
if (i > 0)
fprintf(*orderedSlotFile,",");
fprintf(*orderedSlotFile,"%u",theDefclass->slotNameMap[i]);
}
*orderedSlotArrayCount += (int) theDefclass->maxSlotNameID + 1;
*orderedSlotFile = CloseFileIfNeeded(theEnv,*orderedSlotFile,orderedSlotArrayCount,
orderedSlotArrayVersion,maxIndices,
reopenOrderedSlotFile,orderedSlotCodeFile);
return(TRUE);
}
/*************************************************************
NAME : HandlersToCode
DESCRIPTION : Prints out message-handlers -
all message-handlers for a particular class
are guaranteed to be in the same array
partition
INPUTS : 1) A buffer for the handler file
2) The base image name
3) The id for this type of data
4) The base image id
5) The general header file
6) A buffer for the version number of
the file for this type of data
7) The maximum # of elements in any array
8) A pointer to the class
9) A buffer holding the handler partition #
10) A buffer holding the handler relative
index in the partition
11) A buffer for a flag indicating if the
buffer file can be reopened later
12) A pointer to the file info for
this data if the last file needs
to be reopened for termination
RETURNS : TRUE if all OK, FALSE
otherwise
SIDE EFFECTS : Handlers written
NOTES : None
*************************************************************/
static intBool HandlersToCode(
void *theEnv,
FILE **handlerFile,
char *fileName,
int fileID,
int imageID,
FILE *headerFP,
int *fileCount,
int maxIndices,
DEFCLASS *theDefclass,
int *handlerArrayVersion,
int *handlerArrayCount,
int *reopenHandlerFile,
struct CodeGeneratorFile *handlerCodeFile)
{
register unsigned i;
HANDLER *hnd;
if (theDefclass->handlerCount == 0)
return(TRUE);
*handlerFile = OpenFileIfNeeded(theEnv,*handlerFile,fileName,fileID,
imageID,fileCount,
*handlerArrayVersion,headerFP,
"HANDLER",HandlerPrefix(),*reopenHandlerFile,
handlerCodeFile);
if (*handlerFile == NULL)
return(FALSE);
for (i = 0 ; i < theDefclass->handlerCount ; i++)
{
if (i > 0)
fprintf(*handlerFile,",\n");
hnd = &theDefclass->handlers[i];
fprintf(*handlerFile,"{ %u,%u,0,0,0,",hnd->system,hnd->type);
PrintSymbolReference(theEnv,*handlerFile,hnd->name);
fprintf(*handlerFile,",");
PrintClassReference(theEnv,*handlerFile,hnd->cls,imageID,maxIndices);
fprintf(*handlerFile,",%d,%d,%d,",hnd->minParams,hnd->maxParams,
hnd->localVarCount);
ExpressionToCode(theEnv,*handlerFile,hnd->actions);
fprintf(*handlerFile,",NULL }");
}
*handlerArrayCount += (int) theDefclass->handlerCount;
*handlerFile = CloseFileIfNeeded(theEnv,*handlerFile,handlerArrayCount,
handlerArrayVersion,maxIndices,
reopenHandlerFile,handlerCodeFile);
return(TRUE);
}
/****************************************************************
NAME : OrderedHandlersToCode
DESCRIPTION : Prints out handler map -
the entire handler map
for a particular class is
guaranteed to be in the same
array partition
INPUTS : 1) A buffer for the handler map file
2) The base image name
3) The id for this type of data
4) The base image id
5) The general header file
6) A buffer for the version number of
the file for this type of data
7) The maximum # of elements in any array
8) A pointer to the class
9) A buffer holding the handler map partition #
10) A buffer holding the handler map relative
index in the partition
11) A buffer for a flag indicating if the
buffer file can be reopened later
12) A pointer to the file info for
this data if the last file needs
to be reopened for termination
RETURNS : TRUE if all OK, FALSE
otherwise
SIDE EFFECTS : Handler maps written
NOTES : None
****************************************************************/
static intBool OrderedHandlersToCode(
void *theEnv,
FILE **orderedHandlerFile,
char *fileName,
int fileID,
int imageID,
FILE *headerFP,
int *fileCount,
int maxIndices,
DEFCLASS *theDefclass,
int *orderedHandlerArrayVersion,
int *orderedHandlerArrayCount,
int *reopenOrderedHandlerFile,
struct CodeGeneratorFile *orderedHandlerCodeFile)
{
register unsigned i;
if (theDefclass->handlerCount == 0)
return(TRUE);
*orderedHandlerFile = OpenFileIfNeeded(theEnv,*orderedHandlerFile,fileName,fileID,
imageID,fileCount,
*orderedHandlerArrayVersion,headerFP,
"unsigned",OrderedHandlerPrefix(),
*reopenOrderedHandlerFile,
orderedHandlerCodeFile);
if (*orderedHandlerFile == NULL)
return(FALSE);
for (i = 0 ; i < theDefclass->handlerCount ; i++)
{
if (i > 0)
fprintf(*orderedHandlerFile,",");
fprintf(*orderedHandlerFile,"%u",theDefclass->handlerOrderMap[i]);
}
*orderedHandlerArrayCount += (int) theDefclass->handlerCount;
*orderedHandlerFile = CloseFileIfNeeded(theEnv,*orderedHandlerFile,orderedHandlerArrayCount,
orderedHandlerArrayVersion,maxIndices,
reopenOrderedHandlerFile,
orderedHandlerCodeFile);
return(TRUE);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -