/*********************************************************************************** NAME : MVSlotDeleteCommand DESCRIPTION : Allows user to delete a specified field of a multi-value slot The slot is directly read (w/o a get- message) and the new slot-value is placed via a put- message. This function is not valid for single-value slots. INPUTS : Caller's result buffer RETURNS : TRUE if multi-value slot successfully modified, FALSE otherwise SIDE EFFECTS : Put message sent for slot NOTES : H/L Syntax : (slot-delete$ <instance> <slot> <range-begin> <range-end>) ***********************************************************************************/ globle void MVSlotDeleteCommand( void *theEnv, DATA_OBJECT *result) { DATA_OBJECT newseg,oldseg; INSTANCE_TYPE *ins; INSTANCE_SLOT *sp; int rb,re; EXPRESSION arg; result->type = SYMBOL; result->value = EnvFalseSymbol(theEnv); ins = CheckMultifieldSlotInstance(theEnv,"slot-delete$"); if (ins == NULL) return; sp = CheckMultifieldSlotModify(theEnv,DELETE_OP,"slot-delete$",ins, GetFirstArgument()->nextArg,&rb,&re,NULL); if (sp == NULL) return; AssignSlotToDataObject(&oldseg,sp); if (DeleteMultiValueField(theEnv,&newseg,&oldseg,rb,re,"slot-delete$") == FALSE) return; arg.type = MULTIFIELD; arg.value = (void *) &newseg; arg.nextArg = NULL; arg.argList = NULL; DirectMessage(theEnv,sp->desc->overrideMessage,ins,result,&arg); }
/*********************************************************************************** NAME : MVSlotInsertCommand DESCRIPTION : Allows user to insert a specified field of a multi-value slot The slot is directly read (w/o a get- message) and the new slot-value is placed via a put- message. This function is not valid for single-value slots. INPUTS : Caller's result buffer RETURNS : TRUE if multi-value slot successfully modified, FALSE otherwise SIDE EFFECTS : Put messsage sent for slot NOTES : H/L Syntax : (slot-insert$ <instance> <slot> <index> <value>) ***********************************************************************************/ globle void MVSlotInsertCommand( void *theEnv, DATA_OBJECT *result) { DATA_OBJECT newval,newseg,oldseg; INSTANCE_TYPE *ins; INSTANCE_SLOT *sp; long theIndex; EXPRESSION arg; result->type = SYMBOL; result->value = EnvFalseSymbol(theEnv); ins = CheckMultifieldSlotInstance(theEnv,(char*)"slot-insert$"); if (ins == NULL) return; sp = CheckMultifieldSlotModify(theEnv,INSERT,(char*)"slot-insert$",ins, GetFirstArgument()->nextArg,&theIndex,NULL,&newval); if (sp == NULL) return; AssignSlotToDataObject(&oldseg,sp); if (InsertMultiValueField(theEnv,&newseg,&oldseg,theIndex,&newval,(char*)"slot-insert$") == FALSE) return; arg.type = MULTIFIELD; arg.value = (void *) &newseg; arg.nextArg = NULL; arg.argList = NULL; DirectMessage(theEnv,sp->desc->overrideMessage,ins,result,&arg); }