void ProxyViz::pressToLoad() { MObject thisNode = thisMObject(); MPlug plugc( thisNode, acachename ); const MString filename = plugc.asString(); if(filename != "") loadExternal(replaceEnvVar(filename).c_str()); else AHelper::Info<int>("ProxyViz error empty external cache filename", 0); }
int main(int argc, char* argv[]) { char hostName[200] = DEFAULT_HOSTNAME; int port = DEFAULT_RESMGR_TPM_PORT; TPMI_RH_HIERARCHY hierarchyValue; TPM2B_PUBLIC inPublic; TPM2B_SENSITIVE inPrivate; UINT16 size; memset(&inPublic,0,sizeof(TPM2B_PUBLIC)); memset(&inPrivate,0,sizeof(TPM2B_SENSITIVE)); setbuf(stdout, NULL); setvbuf (stdout, NULL, _IONBF, BUFSIZ); int opt = -1; const char *optstring = "hvH:u:r:p:d:C:"; static struct option long_options[] = { {"help",0,NULL,'h'}, {"version",0,NULL,'v'}, {"Hierachy",1,NULL,'H'}, {"pubfile",1,NULL,'u'}, {"privfile",1,NULL,'r'}, {"port",1,NULL,'p'}, {"debugLevel",1,NULL,'d'}, {"context",1,NULL,'C'}, {0,0,0,0} }; int returnVal = 0; int flagCnt = 0; int h_flag = 0, v_flag = 0, H_flag = 0, u_flag = 0, C_flag = 0, r_flag = 0; char *contextFile = NULL; if(argc == 1) { showHelp(argv[0]); return 0; } while((opt = getopt_long(argc,argv,optstring,long_options,NULL)) != -1) { switch(opt) { case 'h': h_flag = 1; break; case 'v': v_flag = 1; break; case 'H': if(getHierarchyValue(optarg,&hierarchyValue) != 0) { returnVal = -1; break; } printf("\nhierarchyValue: 0x%x\n\n",hierarchyValue); H_flag = 1; break; case 'u': size = sizeof(inPublic); if(loadDataFromFile(optarg, (UINT8 *)&inPublic, &size) != 0) { returnVal = -2; break; } u_flag = 1; break; case 'r': size = sizeof(inPrivate); if(loadDataFromFile(optarg, (UINT8 *)&inPrivate, &size) != 0) { returnVal = -3; break; } r_flag = 1; break; case 'p': if( getPort(optarg, &port) ) { printf("Incorrect port number.\n"); returnVal = -4; } break; case 'd': if( getDebugLevel(optarg, &debugLevel) ) { printf("Incorrect debug level.\n"); returnVal = -5; } break; case 'C': contextFile = optarg; if(contextFile == NULL || contextFile[0] == '\0') { returnVal = -6; break; } printf("contextFile = %s\n", contextFile); C_flag = 1; break; case ':': // printf("Argument %c needs a value!\n",optopt); returnVal = -7; break; case '?': // printf("Unknown Argument: %c\n",optopt); returnVal = -8; break; //default: // break; } if(returnVal) break; }; if(returnVal != 0) return returnVal; flagCnt = h_flag + v_flag + H_flag + u_flag ; if(flagCnt == 1) { if(h_flag == 1) showHelp(argv[0]); else if(v_flag == 1) showVersion(argv[0]); else { showArgMismatch(argv[0]); return -9; } } else if(flagCnt == 2 && H_flag == 1 && u_flag == 1) { prepareTest(hostName, port, debugLevel); returnVal = loadExternal(hierarchyValue, &inPublic, &inPrivate, r_flag); if(returnVal == 0 && C_flag) returnVal = saveTpmContextToFile(sysContext, handle2048rsa, contextFile); finishTest(); if(returnVal) return -10; } else { showArgMismatch(argv[0]); return -11; } return 0; }
void xml::lex::getDTD(xml::token *tok) { static const char* s_system = "SYSTEM"; static const char* s_public = "PUBLIC"; static const char* s_markupDeclStart = "["; static const char* s_markupDeclEnd = "]"; static const char* s_entityDecl = "<!ENTITY"; static const char* s_entityEnd = ">"; static const char* s_parsedEntityRef = "%"; dtdTop:; switch (m_sstate) { case _xml_dtd_name : if (handleWhitespace() == false) { throw GException("XML Parser", 20, m_line, m_byte); } if (getName(tok) == false) { throw GException("XML Parser", 0, m_line, m_byte); } m_documentType = new char[tok->length() + 1]; memcpy(m_documentType, tok->get(), tok->length()); m_documentType[tok->length()] = 0; tok->release(); handleWhitespace(); // check for external identifiers if (handleReserved(s_system) != false) m_sstate = _xml_system_literal; else if (handleReserved(s_public) != false) m_sstate = _xml_public_literal; else m_sstate = _xml_pre_markup; goto dtdTop; case _xml_system_literal : if (handleWhitespace() == false) { throw GException("XML Parser", 20, m_line, m_byte); } getQuote(); tok->m_type = _systemLiteral; getLiteral(tok); getQuote(); // load the external DTD using the // DTD callback function if (m_state == xml::_xml_dtd) loadExternal(m_lpfnExternalDTD, tok); m_sstate = _xml_pre_markup; break; case _xml_public_literal : if (handleWhitespace() == false) { throw GException("XML Parser", 20, m_line, m_byte); } getQuote(); tok->m_type = _publicLiteral; getLiteral(tok); getQuote(); m_sstate = _xml_system_literal; break; case _xml_pre_markup : handleWhitespace(); if (handleReserved(s_markupDeclStart) != false) { m_sstate = _xml_markup; goto dtdTop; } m_sstate = _xml_post_markup; break; case _xml_markup : handleWhitespace(); if (handleReserved(s_markupDeclEnd) != false) { m_sstate = _xml_post_markup; goto dtdTop; } getMisc(tok); // look for elements, attribute lists, entities, and notation if (tok->m_type == xml::_unknown) { if (handleReserved(s_entityDecl) != false) { m_parameterEntity = false; if (handleWhitespace() == false) { throw GException("XML Parser", 20, m_line, m_byte); } // declaration of a parameter entity if (handleReserved(s_parsedEntityRef) != false) { m_parameterEntity = true; if (handleWhitespace() == false) { throw GException("XML Parser", 20, m_line, m_byte); } } tok->m_type = _entityName; if (getName(tok) == false) { throw GException("XML Parser", 11, m_line, m_byte); } xml::entity *p = new xml::entity(); p->setTag(tok); if (m_parameterEntity == false) { if (m_generalEntities != 0) m_generalEntities->AddLast(p); } else { if (m_parameterEntities != 0) m_parameterEntities->AddLast(p); } m_sstate = _xml_entity; } else if (handleReserved(s_parsedEntityRef) != false) { handleEntityReference(); goto dtdTop; } } break; case _xml_entity : if (handleWhitespace() == false) { throw GException("XML Parser", 20, m_line, m_byte); } getQuote(); tok->m_type = xml::_entityValue; if (getEntity(tok) != false) { xml::entity *p = 0; if (m_parameterEntity == false) { if (m_generalEntities != 0) p = (xml::entity *)m_generalEntities->Last(); } else { if (m_parameterEntities != 0) p = (xml::entity *)m_parameterEntities->Last(); } p->setValue(tok); } else { throw GException("XML Parser", 9, m_line, m_byte); } getQuote(); m_sstate = _xml_entity_end; break; case _xml_entity_end : handleWhitespace(); if (handleReserved(s_entityEnd) == false) { throw GException("XML Parser", 7, m_line, m_byte); } m_sstate = _xml_markup; goto dtdTop; case _xml_post_markup : handleWhitespace(); if ((handleReserved(s_entityEnd) == false) && (m_postmarkup != false)) { throw GException("XML Parser", 1, m_line, m_byte); } m_state = _misc; m_nextState = _content; m_sstate = _xml_element_start; } if ((m_state == _xml_dtd) && (tok->m_type == xml::_unknown)) { m_sstate = _xml_post_markup; goto dtdTop; } }