Exemplo n.º 1
0
MRJPage::MRJPage(MRJSession* session, UInt32 documentID, const char* codeBase, const char* archive, Boolean mayScript)
	:	mRefCount(0), mNextPage(NULL), mSession(session), mPageRef(NULL),
		mDocumentID(documentID), mCodeBase(strdup(codeBase)), mArchive(strdup(archive)), mMayScript(mayScript)
{
	pushPage();

	if (&::JMNewAppletPage != NULL) {
		OSStatus status = ::JMNewAppletPage(&mPageRef, session->getSessionRef());
		if (status != noErr) mPageRef = NULL;
	}
}
Exemplo n.º 2
0
MRJPage::MRJPage(MRJSession* session, const MRJPageAttributes& attributes)
	:	mRefCount(0), mNextPage(NULL), mSession(session), mPageRef(NULL),
		mDocumentID(attributes.documentID), mCodeBase(strdup(attributes.codeBase)),
		mArchive(strdup(attributes.archive)), mMayScript(attributes.mayScript)
{
	pushPage();

	if (&::JMNewAppletPage != NULL) {
		OSStatus status = ::JMNewAppletPage(&mPageRef, session->getSessionRef());
		if (status != noErr) mPageRef = NULL;
	}
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
   (void) nlhs; // To avoid the unused parameter warning
   static int atExitRegistered = 0;
   if (!atExitRegistered)
   {
      atExitRegistered = 1;
      mexAtExit(clearAllWrapper);
   }
   if (nrhs < 1)
   {
      mexErrMsgTxt("BLOCK_INTERFACE: Not enough input arguments.");
   }

   const mxArray* mxCmd = prhs[0];
   char command[COMMAND_LENGTH];
   size_t comStrLen = mxGetNumberOfElements(mxCmd);
   mxGetString(mxCmd, command, comStrLen + 1);

   if (!strncmp(command, "set", 3))
   {
      if (nrhs < 2)
      {
         mexErrMsgTxt("BLOCK_INTERFACE: Not enough arguments for the set method.");
      }
      biEntry* cmdStruct = lookupEntry(command + 3, vars, ARRAYLEN(vars));

      if (cmdStruct == NULL)
      {
         mexErrMsgTxt("BLOCK_INTERFACE: Unrecognized set command.");
      }
      cmdStruct->setter(cmdStruct, prhs[1]);
      return;
   }
   else if (!strncmp(command, "get", 3))
   {
      if (nrhs > 1)
      {
         mexErrMsgTxt("BLOCK_INTERFACE: Too many input arguments for get method.");
      }
      biEntry* cmdStruct = lookupEntry(command + 3, vars, ARRAYLEN(vars));
      if (cmdStruct == NULL)
      {
         mexErrMsgTxt("BLOCK_INTERFACE: Unrecognized get command.");
      }
      plhs[0] = cmdStruct->getter(cmdStruct);
      return;
   }
   else if (!strcmp(command, "reset"))
   {
      resetAll(vars, ARRAYLEN(vars));
      return;

   }
   else if (!strcmp(command, "incPageNo"))
   {
      incPageNo();
      return;
   }
   else if (!strcmp(command, "popPage"))
   {
      plhs[0] = popPage();
      return;
   }
   else if (!strcmp(command, "pushPage"))
   {
      pushPage(prhs[1]);
      return;
   }
   else if (!strcmp(command, "clearAll"))
   {
      clearAllWrapper();
      return;
   }
   else if (!strcmp(command, "flushBuffers"))
   {
      biEntry* be1 = lookupEntry("AnaOverlap", vars, ARRAYLEN(vars));

      if (be1->var != NULL)
      {
         mxDestroyArray(be1->var);
         be1->var = NULL;
      }
      biEntry* be2 = lookupEntry("SynOverlap", vars, ARRAYLEN(vars));

      if (be2->var != NULL)
      {
         mxDestroyArray(be2->var);
         be2->var = NULL;
      }
      return;
   }

   mexErrMsgTxt("BLOCK_INTERFACE: Unrecognized command.");

}