Пример #1
0
LRESULT CIMContainer::OnDasherEvent(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
  // Apparently putting the typecast directly in the switch doesn't work
  CEvent *pEvent( (CEvent *)lParam );
  
  // TODO: return if handled?
  switch(pEvent->m_iEventType) {
   case EV_EDIT: {
    Dasher::CEditEvent * pEvt(static_cast< Dasher::CEditEvent * >(pEvent));
     
    switch (pEvt->m_iEditType) {
      case 1:
       SendOutput(pEvt->m_sText);
       break;
      case 2:
	     SendDelete(pEvt->m_sText.size());
	     break;
      default:
        break;
    }
    break;
                 }
  default:
    break;
  }
  
  return 0;
}
Пример #2
0
int xml_main(int argc, char **argv)
{
	char *serversoft = getenv ("SERVER_SOFTWARE");
	LOG_SERVER_SOFT;
	LOG_NODE_NAME;

	char c = '0';
	char p[] = "/dev/in";
	int fd;

	int iOptindexer = 1;
	int bIndexerReady = 0;
	if (Mode != single_operation)
		bIndexerReady = checkIndexer();
	else
		bIndexerReady = 1;

	int bDeleteFromIndex = 0;
	int bTemplateIndex = 0;
	int bSaveXML = 0;
	int i = 0;
	char deviceoutputname[250];
	sprintf (deviceoutputname, "%s", DEV_OUTPUT_NAME);
	for ( i = 0; i < argc; i++)
	{
		if ((strncmp(argv[i], "--savexml", strlen (argv[i]))) == 0)
			bSaveXML = 1;
		if ((strncmp(argv[i], "--delete", strlen (argv[i]))) == 0)
			bDeleteFromIndex = 1;

		if ((strncmp(argv[i], "--template", strlen (argv[i]))) == 0)
			bTemplateIndex = 1;

	}

	if (bSaveXML == 1)
		sprintf (deviceoutputname, "/dev/output");
	else
		if (bIndexerReady != 1)
		{
			printf ("***Error indexer not ready\n");
			return 1;
		}


	if (Mode == single_operation)
    	sprintf (deviceoutputname, "%s", XML_SINGLE_MODE_OUTPUT_FILE);
	else
		if(bDeleteFromIndex == 0)
			LOG_ZVM ("***ZVMLog", "incoming channels dir", "s", p, 1);

	LOG_ZVM ("***ZVMLog", "output channel name", "s", deviceoutputname, 1);


	fd = open (deviceoutputname, O_WRONLY | O_CREAT | O_TRUNC, S_IROTH | S_IWOTH | S_IRUSR | S_IWUSR);
	if (fd <= 0)
	{
		printf ("*** ZVM. Error open %s deivce\n", DEV_OUTPUT_NAME);
		return 1;
	}


	struct field_list fl = getList ("/dev/input");

	LOG_ZVM ("***ZVMLog", "doc count", "d", docID, 1);
	createxmlpipe (fd, fl);
	if (bDeleteFromIndex == 0 && bTemplateIndex == 0)
	{
		LOG_ZVM ("***ZVMLog", "incoming channels dir", "s", deviceoutputname, 1);
		int doccount = 0;
		if (Mode == single_operation)
			doccount = getdatafromchannel (fd, EXTRACTOR_SINGLE_MODE_OUTPUT_FILE, docID, fl);
		else
			mylistdir_xmlpipe (fd, p, fl);
	}
	else if ((bDeleteFromIndex == 1 && bTemplateIndex == 0))
	{
		LOG_ZVM ("***ZVMLog", "incoming channels dir", "s", p, 1);
		SendDelete (fd, fl);
	}
	else if ((bDeleteFromIndex == 0 && bTemplateIndex == 1))
	{
/*
		LOG_ZVM ("***ZVMLog", "incoming channels dir", "s", p, 1);
		SendDelete (fd);
*/
	}
	closexmlpipe (fd);
	close (fd);
	printf ("*** ZVM xmlpipe - OK\n");
	return 0;
}