コード例 #1
0
static SECStatus
secu_PrintUserNoticeQualifier(FILE *out, SECItem * qualifierValue,
                              char *msg, int level)
{
    CERTUserNotice *userNotice = NULL;
    if (qualifierValue)
	userNotice = CERT_DecodeUserNotice(qualifierValue);
    if (userNotice) {
	if (userNotice->noticeReference.organization.len != 0) {
            char *string = 
	            itemToString(&userNotice->noticeReference.organization);
            SECItem **itemList = userNotice->noticeReference.noticeNumbers;

	    while (itemList && *itemList) {
		SECU_PrintInteger(out,*itemList,string,level+1);
	        itemList++;
	    }
	    PORT_Free(string);
	}
	if (userNotice->displayText.len != 0) {
	    SECU_PrintString(out,&userNotice->displayText,
			     "Display Text", level+1);
	}
	CERT_DestroyUserNotice(userNotice);
	return SECSuccess;
    }
    return SECFailure;	/* caller will print this value */
}
コード例 #2
0
String Grammar::stateToString(const LR1State &state, int flags) const {
  String result;
  result = format(_T("State %d:\n"), state.m_index);
  const int itemstodump = (flags & DUMP_KERNELONLY) ? state.m_noOfKernelItems : (int)state.m_items.size();
  for(int i = 0; i < itemstodump; i++) {
    const LR1Item &item = state.m_items[i];
    if(isShiftItem(item) && !(flags & DUMP_SHIFTITEMS)) {
      continue;
    }
    result += itemToString(state.m_items[i], flags) + _T("\n");
  }
  if(flags & DUMP_ACTIONS) {
    result += _T("\n");
    const ActionArray &actions    = m_result[state.m_index].m_actions;
    const ActionArray &successors = m_result[state.m_index].m_succs;
    for(size_t i = 0; i < actions.size(); i++) {
      const ParserAction &act = actions[i];
      if(act.m_action > 0) { // shiftItem
        result += format(_T("   shift to %d on %s\n"), act.m_action, getSymbol(act.m_token).m_name.cstr());
      } else if(act.m_action < 0) { // reduceItem
        result += format(_T("   reduce by %d on %s\n"), -act.m_action, getSymbol(act.m_token).m_name.cstr());
      } else { // accept
        result += format(_T("   accept on %s\n"), getSymbol(act.m_token).m_name.cstr());
      }
    }
    for(size_t i = 0; i < successors.size(); i++) {
      const ParserAction &act = successors[i];
      result += format(_T("   goto %d on %s\n"), act.m_action, getSymbol(act.m_token).m_name.cstr());
    }
  }
  return result;
}
コード例 #3
0
void Grammar::dump(const LR1Item &item, int flags, MarginFile *f) const {
  f->printf(_T("%s\n"), itemToString(item, flags).cstr());
}