}

/* VLR_DETACH hptr( optr optrUI );  */
hptr _pascal TVDetach( optr optrUI ) {
  /* We will save our data to state, close the document, and discard UI */
  MemHandle theState;

  theState = @call optrUI::MSG_MVD_SAVE_STATE();
  @call optrUI::MSG_MVD_CLOSE_DOCUMENT();
  @call optrUI::MSG_VD_CLOSE( GeodeGetCodeProcessHandle(), VCS_CLOSED );
  return( theState );
}

/* VLR_CHANGE_DOCUMENT   void( ViewerChangeDocumentStruct *vcds) */
void _pascal TVChangeDocument( ViewerChangeDocumentStruct *vcds) {
  /* Swit