Пример #1
0
void CLogTrigger::EndTrigger(const void *pBuffer, int nLen, SLogInfo &sLog)
{           
    const STriggerItem *pItem = sLog.pItem;    
    if (pItem->nResSize == 0 )
    {        
        BuildLogInfo(sLog, "NULL");
        return;
    }        
    string strRes;
    if (pBuffer == NULL)
    {
        strRes = GetDefaultValue(pItem->nResSize); 
    }
    else
    {    
        SSapMsgHeader *pHead = (SSapMsgHeader *)pBuffer;
        void *pBody = (unsigned char *)pBuffer + pHead->byHeadLen;
        int nBodyLen = nLen - pHead->byHeadLen;          
        if (/* nBodyLen > 0 &&*/ m_pConfig != NULL)
        {        
            CAvenueMsgHandler oHandler(sLog.serviceName, false, m_pConfig);      
            oHandler.Decode(pBody, nBodyLen);
            strRes = BuildLog(&oHandler, NULL, pItem->vecRes, sLog.mapKey);        
        }
        else
        {  
            strRes = GetDefaultValue(pItem->nResSize); 
        }  
    }
    BuildLogInfo(sLog, strRes);
}
Пример #2
0
void PHPEntityVariable::PrintStdout(int indent) const
{
    wxString indentString(' ', indent);
    wxPrintf("%s%s: %s", indentString, IsMember() ? "Member" : "Variable", GetShortName());
    if(!GetTypeHint().IsEmpty()) {
        wxPrintf(", TypeHint: %s", GetTypeHint());
    }
    if(!GetExpressionHint().IsEmpty()) {
        wxPrintf(", ExpressionHint: %s", GetExpressionHint());
    }
    if(IsReference()) {
        wxPrintf(", Reference");
    }
    if(!GetDefaultValue().IsEmpty()) {
        wxPrintf(", Default: %s", GetDefaultValue());
    }

    wxPrintf(", Ln. %d", GetLine());
    wxPrintf("\n");

    PHPEntityBase::List_t::const_iterator iter = m_children.begin();
    for(; iter != m_children.end(); ++iter) {
        (*iter)->PrintStdout(indent + 4);
    }
}
CefRefPtr<CefV8Value> V8_Container::CreateContainerV8Object()
{
    CefRefPtr<CefV8Value> containerObj = CefV8Value::CreateObject(NULL);

    for (int i = 0; i < (int)_scheme.size(); i++)
    {
        ContainerAttribute attr = _scheme[i];

        int arraySize = attr.GetArraySize();
        if (arraySize == 0)
        {
            // Add empty V8 value as given attribute name to V8 container object
            containerObj->SetValue(attr.GetName(), GetDefaultValue(attr.GetDatatype()), V8_PROPERTY_ATTRIBUTE_NONE);
        }
        else if (arraySize > 0)
        {
            CefRefPtr<CefV8Value> array = CefV8Value::CreateArray(arraySize),
                defaultValue = GetDefaultValue(attr.GetDatatype());
            for (int j = 0; j < arraySize; j++)
            {
                array->SetValue(j, defaultValue);
            }
            // Add empty V8 array as given attribute name to V8 container object
            containerObj->SetValue(attr.GetName(), array, V8_PROPERTY_ATTRIBUTE_NONE);
        }
        else // ERROR CASE
        {
            // DLOG(INFO) << "WARNING: scheme[" << i << "] array size < 0!";
        }
    }
    return containerObj;
}
Пример #4
0
void CLogTrigger::BeginTrigger(const void *pBuffer, int nLen, SLogInfo &sLog)
{    
    SSapMsgHeader *pHead = (SSapMsgHeader *)pBuffer;
    int nServId = ntohl(pHead->dwServiceId);
    int nMsgId  = ntohl(pHead->dwMsgId);       
    
    sLog.pItem = CTriggerConfig::Instance()->GetInfo(TRIGGERTYPE,nServId, nMsgId);    
    if (sLog.pItem == NULL || sLog.pItem->nReqSize == 0)
    {
        return;
    }  
    
    void *pBody  = (unsigned char *)pBuffer + pHead->byHeadLen;
    int nBodyLen = nLen - pHead->byHeadLen;  
    if (nBodyLen == 0)
    {
        sLog.strReq[0] = GetDefaultValue(sLog.pItem->nReqSize);
        return;
    }
    
    if (m_pConfig == NULL || 
        0 != m_pConfig->GetServiceNameById(nServId, nMsgId, sLog.serviceName))
    {  
        SS_XLOG(XLOG_DEBUG,"CLogTrigger::%s service[%d],msg[%d] not found\n",
            __FUNCTION__,nServId, nMsgId); 
        sLog.strReq[0] = GetDefaultValue(sLog.pItem->nReqSize);
        return;
    }
    
    CAvenueMsgHandler oHandler(sLog.serviceName,true,m_pConfig);      
    oHandler.Decode(pBody, nBodyLen);
    sLog.strReq[0] = BuildLog(&oHandler, NULL, sLog.pItem->vecReq, sLog.mapKey); 
}
Пример #5
0
string CLogTrigger::GetDefaultLog(int nServId, int nMsgId)
{
    STriggerItem *pItem = CTriggerConfig::Instance()->GetInfo(TRIGGERTYPE,nServId, nMsgId);
    const string defReq = GetDefaultValue(pItem->nReqSize);
    const string defRes = GetDefaultValue(pItem->nResSize);
    char szBuf[MAX_LOG_BUFFER];
    snprintf(szBuf, sizeof(szBuf)-1, "%s,  ,  ,  %s,  %s", 
        ASC_VERSION, defReq.c_str(), defRes.c_str());    
    return szBuf;
}
Пример #6
0
    T GetValue() const
    {
        if (IsEmpty())
            return GetDefaultValue();

        return value_;
    }
Пример #7
0
Файл: MacGraph.c Проект: rolk/ug
OUTPUTDEVICE *InitMacOutputDevice (void)
{
  char buffer[32];

  /* create output device */
  if ((MacOutputDevice=CreateOutputDevice("screen"))==NULL) return(NULL);

  /* set global variables */
  qdgray = GetQDGlobalsBlack(qdgray);

  /* init output device 'screen' */
  MacOutputDevice->OpenOutput     = Mac_OpenOutput;
  MacOutputDevice->CloseOutput    = Mac_CloseOutput;
  MacOutputDevice->ActivateOutput = Mac_ActivateOutput;
  MacOutputDevice->UpdateOutput   = Mac_UpdateOutput;

  MacOutputDevice->v.locked               = 1;

  InitMacPort ();

  /* get gui heapsize */
  if (GetDefaultValue(DEFAULTSFILENAME,"guimemory",buffer)==0)
    sscanf(buffer," %d ",&guiHeapSize);

  /* allocate gui heap */
  if ((guiHeap=NewHeap(GENERAL_HEAP,guiHeapSize,malloc(guiHeapSize)))==NULL) return(NULL);

  return (MacOutputDevice);
}
Пример #8
0
Файл: surface.c Проект: rolk/ug
INT GenerateSurfaceGrid (HEAP *theHeap, INT MarkKey, LGM_SURFACE *aSurface, DOUBLE h, INT smooth,INT display, INT D)
{
  INT sid,i;
  char rulefilename[128];
  DOUBLE **x;

  theSurface = aSurface;
  Heap = theHeap;
  LGM_MarkKey = MarkKey;

  ntriangle = 0;

  if (GetDefaultValue(DEFAULTSFILENAME,"netgentrianglerules",rulefilename)) strcpy(rulefilename,rulefilename);
  if (ExpandCShellVars(rulefilename)==NULL)
  {
    PrintErrorMessageF('W',"GenerateSurfaceGrid","could not expand shell variables in 'netgentrianglerules' of defaults file '%s'",DEFAULTSFILENAME);
    return (1);
  }

    #ifdef _NETGEN
  if (StartSurfaceNetgen(h,smooth,display, D)) return(1);
    #endif

  Search_Neighbour_Triangle(1);
  Modify_Triangulation(1);

  return(0);
}
Пример #9
0
const_shared_ptr<Result> ComplexType::PreprocessSymbol(
		const std::shared_ptr<ExecutionContext> execution_context,
		const_shared_ptr<ComplexTypeSpecifier> type_specifier,
		const_shared_ptr<Expression> initializer) const {
	ErrorListRef errors = ErrorList::GetTerminator();

	plain_shared_ptr<void> value;
	plain_shared_ptr<Symbol> symbol = Symbol::GetDefaultSymbol();

	auto type_table = execution_context->GetTypeTable();
	if (initializer) {
		errors = initializer->Validate(execution_context);
		if (ErrorList::IsTerminator(errors)) {
			return PreprocessSymbolCore(execution_context, type_specifier,
					initializer);
		}
	} else {
		auto type_result = type_specifier->GetType(type_table);
		errors = type_result->GetErrors();
		if (ErrorList::IsTerminator(errors)) {
			auto type = type_result->GetData<TypeDefinition>();
			value = type->GetDefaultValue(type_table);
		}
	}

	if (ErrorList::IsTerminator(errors)) {
		//we've been able to get a good initial value (that is, no errors have occurred)
		symbol = GetSymbol(type_table, type_specifier, value);
	}

	return make_shared<Result>(symbol, errors);
}
Пример #10
0
void
nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap)
{
  // Get the frame.
  // No need to flush here, if there is no frame yet for this textarea
  // there won't be a value in it we don't already have even if we
  // force the frame to be created.
  nsIFrame* primaryFrame = GetPrimaryFrame();
  nsITextControlFrame* textControlFrame = nsnull;
  if (primaryFrame) {
    textControlFrame = do_QueryFrame(primaryFrame);
  }

  // If the frame exists and owns the value, get it from the frame.  Otherwise
  // get it from content.
  PRBool frameOwnsValue = PR_FALSE;
  if (textControlFrame) {
    textControlFrame->OwnsValue(&frameOwnsValue);
  }
  if (frameOwnsValue) {
    textControlFrame->GetValue(aValue, aIgnoreWrap);
  } else {
    if (!mValueChanged || !mValue) {
      GetDefaultValue(aValue);
    } else {
      CopyUTF8toUTF16(mValue, aValue);
    }
  }
}
Пример #11
0
BOOL CObjectEntry::StoreObjectDictionarySchema(XML_PARSER* pXmlParser)
{
    CStdString strIndex = "";
    CStdString strSubIndex = "";
    CStdString strParameterName = "";
    CStdString strObjectType = "";
    CStdString strDataType = "";
    CStdString strAccessType = "";
    CStdString strLowLimit = "";
    CStdString strHighLimit = "";
    CStdString strDefaultValue = "";
    CStdString strPDOMapping = "";
    CStdString strObjFlags = "";

    if(pXmlParser)
    {
        //ObjectEntry
        pXmlParser->AddNewLineTab();
        pXmlParser->Add_LastChildNode(_T("ObjectEntry"));
        pXmlParser->IncTabLevel();

        //Prepare Attributes
        GetIndex(strIndex);
        GetSubIndex(strSubIndex);
        GetParameterName(strParameterName);
        GetObjectType(strObjectType);
        GetDataType(strDataType, FALSE);
        GetAccessType(strAccessType);
        GetLowLimit(strLowLimit);
        GetHighLimit(strHighLimit);
        GetDefaultValue(strDefaultValue);
        GetPDOMapping(strPDOMapping);
        GetObjFlags(strObjFlags);

        //ObjectEntry Attributes
        pXmlParser->Set_Attribute(_T("Index"), strIndex);
        pXmlParser->Set_Attribute(_T("SubIndex"), strSubIndex);
        pXmlParser->Set_Attribute(_T("ParameterName"), strParameterName);
        pXmlParser->Set_Attribute(_T("ObjectType"), strObjectType);
        pXmlParser->Set_Attribute(_T("DataType"), strDataType);
        pXmlParser->Set_Attribute(_T("AccessType"), strAccessType);

        if(!strLowLimit.IsEmpty()) pXmlParser->Set_Attribute(_T("LowLimit"), strLowLimit);
        if(!strHighLimit.IsEmpty()) pXmlParser->Set_Attribute(_T("HighLimit"), strHighLimit);
        if(!strDefaultValue.IsEmpty()) pXmlParser->Set_Attribute(_T("DefaultValue"), strDefaultValue);
        if(!strPDOMapping.IsEmpty()) pXmlParser->Set_Attribute(_T("PDOMapping"), strPDOMapping);
        if(!strObjFlags.IsEmpty()) pXmlParser->Set_Attribute(_T("ObjFlags"), strObjFlags);

        //End ObjectEntry
        pXmlParser->DecTabLevel();
        pXmlParser->AddNewLineTab();
        pXmlParser->Go_to_Parent();

        return TRUE;
    }

    return FALSE;
}
Пример #12
0
void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const {
  if (buf == NULL || m_Family == PDFCS_PATTERN) {
    return;
  }
  FX_FLOAT min, max;
  for (int i = 0; i < m_nComponents; i++) {
    GetDefaultValue(i, buf[i], min, max);
  }
}
Пример #13
0
nsresult HTMLTextAreaElement::Reset() {
  nsAutoString resetVal;
  GetDefaultValue(resetVal, IgnoreErrors());
  SetValueChanged(false);

  nsresult rv =
      SetValueInternal(resetVal, nsTextEditorState::eSetValue_Internal);
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
Пример #14
0
void CLogTrigger::EndTrigger(const void *pBody,
                             int nLen,
                             CAvenueMsgHandler *pHandler,
                             SLogInfo &sLog,
                             const map<string, vector<string> >* mapDefValue)
{
    if (sLog.isBNB)
    {
        if (sLog.pItem->nResSize == 0 )
        {        
            BuildLogInfo(sLog, "NULL");
            return;
        }
        string strRes[2];
        if (nLen > 0)
        {        
            pHandler->Decode(pBody, nLen);     
            vecTriggerItem user1(sLog.pItem->vecRes.begin(), sLog.pItem->vecRes.begin()+sLog.pItem->nResSize/2);
            vecTriggerItem user2(sLog.pItem->vecRes.begin()+sLog.pItem->nResSize/2, sLog.pItem->vecRes.end());
            strRes[0] = BuildLog(pHandler, mapDefValue, user1, sLog.mapKey);
            strRes[1] = BuildLog(pHandler, mapDefValue, user2, sLog.mapKey2);
        }
        else
        {        
            strRes[0] = GetDefaultValue(sLog.pItem->nResSize);
            strRes[1] = strRes[0];
        }
        BuildLogInfo(sLog, strRes[0]);
        char szBuf[MAX_LOG_BUFFER];
        snprintf(szBuf, sizeof(szBuf)-1, 
            "%s,  %s,  %s,  %s,  %s,  %s", 
            ASC_VERSION, sLog.mapKey2[1].c_str(), sLog.mapKey2[2].c_str(), sLog.mapKey2[3].c_str(),
            sLog.strReq[1].c_str(), strRes[1].c_str());
        sLog.plusLogInfo = szBuf;
    }
    else
    {
        string strRes;

        if (nLen > 0)
        {        
			SS_XLOG(XLOG_DEBUG,"CLogTrigger::%s xxx\n",__FUNCTION__);
            pHandler->Decode(pBody, nLen);  
			if (pHandler!=NULL)
			{
				strRes = BuildLog(pHandler, mapDefValue, sLog.pItem->vecRes, sLog.mapKey);
				SS_XLOG(XLOG_DEBUG,"CLogTrigger::%s %d value[%s]\n",__FUNCTION__,sLog.pItem->vecRes.size(),strRes.c_str());
			}			
        }

        BuildLogInfo(sLog, strRes);
    }
}
Пример #15
0
wxString PHPEntityVariable::ToFuncArgString() const
{
    if(!IsFunctionArg()) {
        return "";
    }

    wxString str;
    if(!GetTypeHint().IsEmpty()) {
        str << GetTypeHint() << " ";
    }

    if(IsReference()) {
        str << "&";
    }

    str << GetShortName();
    if(!GetDefaultValue().IsEmpty()) {
        str << " = " << GetDefaultValue();
    }
    return str;
}
Пример #16
0
nsresult
nsHTMLTextAreaElement::Reset()
{
  nsresult rv;
  // If the frame is there, we have to set the value so that it will show up.
  nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE);
  if (formControlFrame) {
    nsAutoString resetVal;
    GetDefaultValue(resetVal);
    rv = SetValue(resetVal);
    NS_ENSURE_SUCCESS(rv, rv);
  }
  SetValueChanged(PR_FALSE);
  return NS_OK;
}
Пример #17
0
nsresult
HTMLTextAreaElement::Reset()
{
  nsresult rv;

  // To get the initial spellchecking, reset value to
  // empty string before setting the default value.
  SetValue(EmptyString());
  nsAutoString resetVal;
  GetDefaultValue(resetVal);
  rv = SetValue(resetVal);
  NS_ENSURE_SUCCESS(rv, rv);

  SetValueChanged(false);
  return NS_OK;
}
Пример #18
0
Файл: surface.c Проект: rolk/ug
INT InitSurface(CoeffProcPtr Coeff)
{
  char rulefilename[128];
  if (GetDefaultValue(DEFAULTSFILENAME,"netgentrianglerules",rulefilename))
    strcpy(rulefilename,"triangle.rls");
  if (ExpandCShellVars(rulefilename)==NULL)
  {
    PrintErrorMessageF('W',"InitSurface","could not expand shell variables in 'netgentrianglerules' of defaults file '%s'",DEFAULTSFILENAME);
    return (1);
  }

  /*	LOCAL_H[0] = Coeff[coeff];*/
  LOCAL_H = Coeff;
    #ifdef _NETGEN
  InitSurfaceNetgen(rulefilename);
    #endif

}
Пример #19
0
// Make an XML element string for this pref.
CString CPrefElement::XML(int iIndentSize, int iIndentLevel)
{
  int iIndentSpaces = iIndentSize * iIndentLevel;

  CString strRet;
  strRet.Format("%*s<PREF uiname=\"%s\" prefname=\"%s\" type=\"%s\" default=\"%s\" lockable=\"%s\" description=\"%s\" useradded=\"%s\">\n", 
    iIndentSpaces, " ", GetUIName(), GetPrefName(), GetPrefType(),
    GetDefaultValue(), IsLockable()?"true":"false", GetPrefDescription(), 
    IsUserAdded()?"true":"false");

  CString strTmp;
  if (IsChoose())
  {
    strTmp.Format("%*s<CHOICES>\n", iIndentSpaces + iIndentSize, " ");
    strRet += strTmp;

    for (int i = 0; i < m_iChoices; i++)
    {
      strTmp.Format("%*s<CHOICE uiname=\"%s\" value=\"%s\"/>\n", iIndentSpaces + iIndentSize + iIndentSize, " ", m_astrChoiceName[i], m_astrChoiceVal[i]);
      strRet += strTmp;
    }

    strTmp.Format("%*s</CHOICES>\n", iIndentSpaces + iIndentSize, " ");
    strRet += strTmp;
  }

  strTmp.Format("%*s<VALUE>%s</VALUE>\n", iIndentSpaces + iIndentSize, " ", GetPrefValue());
  strRet += strTmp;

  strTmp.Format("%*s<LOCKED>%s</LOCKED>\n", iIndentSpaces + iIndentSize, " ", IsLocked()?"true":"false");
  strRet += strTmp;

  strTmp.Format("%*s<REMOTEADMIN>%s</REMOTEADMIN>\n", iIndentSpaces + iIndentSize, " ", IsRemoteAdmin()?"true":"false");
  strRet += strTmp;

  CString strCloseTag;
  strCloseTag.Format("%*s</PREF>\n", iIndentSpaces, " ");

  strRet += strCloseTag;

  return strRet;
}
Пример #20
0
void					WiredLADSPAInstance::AddGuiControl(t_ladspa_port *PortData)
{
	t_gui_control			NewGuiPort;

	if (LADSPA_IS_HINT_BOUNDED_BELOW(PortData->RangeHint.HintDescriptor))
		NewGuiPort.Data.LowerBound = PortData->RangeHint.LowerBound;
	else
		NewGuiPort.Data.LowerBound = 0;
	if (LADSPA_IS_HINT_BOUNDED_ABOVE(PortData->RangeHint.HintDescriptor))
		NewGuiPort.Data.UpperBound = PortData->RangeHint.UpperBound;
	else
		NewGuiPort.Data.UpperBound = 100;
	NewGuiPort.Data.Data = new LADSPA_Data;
	*(NewGuiPort.Data.Data) = GetDefaultValue(&NewGuiPort.Data, PortData->RangeHint.HintDescriptor);
	NewGuiPort.Descriptor.Descriptor = PortData->Descriptor;
	NewGuiPort.Descriptor.RangeHint = PortData->RangeHint;
	NewGuiPort.Descriptor.Name = PortData->Name;
	NewGuiPort.Descriptor.Id = PortData->Id;
	_GuiControls[PortData->Id] = NewGuiPort;
	ConnectMonoInput((float *) NewGuiPort.Data.Data, PortData->Id);
}
Пример #21
0
const_shared_ptr<Result> OpenExpression::Evaluate(
		const shared_ptr<ExecutionContext> context,
		const shared_ptr<ExecutionContext> closure) const {
	// need to handle in-band errors
	// return file handle
	// return platform-dependent error codes; should handle mapping to platform-independent codes in std lib.

	// we assume that our validation pass caught any argument length issues
	auto path_argument_expression = GetArgumentListRef()->GetData();
	auto path_argument_evaluation = path_argument_expression->Evaluate(context,
			closure);

	auto index = 0;
	auto result_code = 0;
	auto result_message = make_shared<string>();
	auto errors = path_argument_evaluation->GetErrors();
	if (ErrorList::IsTerminator(errors)) {
		auto path = path_argument_evaluation->GetData<string>();
		auto mode_argument_expression =
				GetArgumentListRef()->GetNext()->GetData();
		auto mode_argument_evaluation = mode_argument_expression->Evaluate(
				context, closure);

		errors = mode_argument_evaluation->GetErrors();
		if (ErrorList::IsTerminator(errors)) {
			std::ios::openmode open_mode = std::ios::openmode();
			auto mode_definition =
					mode_argument_evaluation->GetData<Record>()->GetDefinition();

			if (*static_pointer_cast<const bool>(
					mode_definition->GetSymbol(*Builtins::STREAM_MODE_IN_NAME)->GetValue())
					== true) {
				open_mode = open_mode | std::ios::in;
			}

			if (*static_pointer_cast<const bool>(
					mode_definition->GetSymbol(*Builtins::STREAM_MODE_OUT_NAME)->GetValue())
					== true) {
				open_mode = open_mode | std::ios::out;
			}

			if (*static_pointer_cast<const bool>(
					mode_definition->GetSymbol(
							*Builtins::STREAM_MODE_BINARY_NAME)->GetValue())
					== true) {
				open_mode = open_mode | std::ios::binary;
			}

			if (*static_pointer_cast<const bool>(
					mode_definition->GetSymbol(*Builtins::STREAM_MODE_ATE_NAME)->GetValue())
					== true) {
				open_mode = open_mode | std::ios::ate;
			}

			if (*static_pointer_cast<const bool>(
					mode_definition->GetSymbol(*Builtins::STREAM_MODE_APP_NAME)->GetValue())
					== true) {
				open_mode = open_mode | std::ios::app;
			}

			if (*static_pointer_cast<const bool>(
					mode_definition->GetSymbol(
							*Builtins::STREAM_MODE_TRUNC_NAME)->GetValue())
					== true) {
				open_mode = open_mode | std::ios::trunc;
			}

			auto stream = make_shared<fstream>();
			stream->exceptions(std::ifstream::failbit | std::ifstream::badbit);
			try {
				stream->open(*path, open_mode);
				// add stream to file handle list
				// N.B. that this process is not synchronized
				index = Builtins::get_file_handle_map()->size();
				Builtins::get_file_handle_map()->insert(
						std::pair<int, volatile_shared_ptr<fstream>>(index,
								stream));
			} catch (std::fstream::failure &e) {
				result_code = errno;
				result_message = make_shared<string>(
						std::strerror(result_code));
			}
		}
	}

	auto type_table = closure->GetTypeTable();
	auto error_list_type_result =
			Builtins::get_error_list_type_specifier()->GetType(type_table,
					RETURN);
	assert(ErrorList::IsTerminator(error_list_type_result->GetErrors()));
	auto error_list_type = error_list_type_result->GetData<TypeDefinition>();

	if (result_code == 0) {
		auto result = make_shared<Sum>(Builtins::INT_RESULT_DATA_NAME,
				make_shared<int>(index));

		return make_shared<Result>(result, errors);
	} else {
		auto error_symbol_map = make_shared<symbol_map>();
		auto insert_result = error_symbol_map->insert(
				std::pair<const string, const_shared_ptr<Symbol>>(
						*Builtins::ERROR_CODE_NAME,
						make_shared<Symbol>(make_shared<int>(result_code))));
		assert(insert_result.second);
		insert_result = error_symbol_map->insert(
				std::pair<const string, const_shared_ptr<Symbol>>(
						*Builtins::ERROR_MESSAGE_NAME,
						make_shared<Symbol>(result_message)));
		assert(insert_result.second);
		auto error_symbol_table = make_shared<SymbolTable>(Modifier::Type::NONE,
				error_symbol_map);
		auto error = make_shared<Record>(error_symbol_table);

		auto error_list_symbol_map = make_shared<symbol_map>();
		insert_result = error_list_symbol_map->insert(
				std::pair<const string, const_shared_ptr<Symbol>>(
						*Builtins::ERROR_LIST_DATA_NAME,
						make_shared<Symbol>(
								Builtins::get_error_type_specifier(), error)));
		assert(insert_result.second);

		auto terminator = static_pointer_cast<const Record>(
				error_list_type->GetDefaultValue(type_table));
		auto error_list_sum = make_shared<Sum>(TypeTable::GetNilName(),
				terminator);
		insert_result = error_list_symbol_map->insert(
				std::pair<const string, const_shared_ptr<Symbol>>(
						*Builtins::ERROR_LIST_NEXT_NAME,
						make_shared<Symbol>(
								Builtins::get_error_list_maybe_type_specifier(),
								error_list_sum)));
		assert(insert_result.second);

		auto error_list_symbol_table = make_shared<SymbolTable>(
				Modifier::Type::NONE, error_list_symbol_map);
		auto error_list = make_shared<Record>(error_list_symbol_table);

		auto result = make_shared<Sum>(Builtins::INT_RESULT_ERRORS_NAME,
				error_list);
		return make_shared<Result>(result, errors);
	}
}
Пример #22
0
HTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue) {
  GetDefaultValue(aValue, IgnoreErrors());
}
Пример #23
0
Файл: initug.c Проект: rolk/ug
INT NS_DIM_PREFIX InitUg (int *argcp, char ***argvp)
{
  INT err;
#ifdef Debug
  char buffer[256];
  char debugfilename[NAMESIZE];
#endif

#ifdef ModelP
  /* init ppif module */
  if ((err = InitPPIF (argcp, argvp)) != PPIF_SUCCESS)
  {
    printf ("ERROR in InitParallel while InitPPIF.\n");
    printf ("aborting ug\n");

    return (1);
  }
#endif

  /* init the low module */
  if ((err = InitLow ()) != 0)
  {
    printf
      ("ERROR in InitUg while InitLow (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }

  /* init parallelization module */
#ifdef ModelP
  PRINTDEBUG (init, 1, ("%d:     InitParallel()...\n", me))
  if ((err = InitParallel (argcp, argvp)) != 0)
  {
    printf
      ("ERROR in InitUg while InitParallel (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }
#endif

  /* create struct for configuration parameters */
  if (MakeStruct (":conf"))
    return (__LINE__);
  if (SetStringVar ("conf:arch", ARCHNAME))
    return (__LINE__);

  /* set variable for parallel modus */
#ifdef ModelP
  if (SetStringValue ("conf:parallel", 1.0))
    return (__LINE__);
  if (SetStringValue ("conf:procs", (DOUBLE) procs))
    return (__LINE__);
  if (SetStringValue ("conf:me", (DOUBLE) me))
    return (__LINE__);
#else
  if (SetStringValue ("conf:parallel", 0.0))
    return (__LINE__);
  if (SetStringValue ("conf:procs", 1.0))
    return (__LINE__);
  if (SetStringValue ("conf:me", 0.0))
    return (__LINE__);
#endif

  /* init the devices module */
  if ((err = InitDevices (argcp, *argvp)) != 0)
  {
    printf
      ("ERROR in InitUg while InitDevices (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }

#ifdef Debug
  {
    int i;
    for (i = 1; i < *argcp; i++)
      if (strncmp ((*argvp)[i], "-dbgfile", 8) == 0)
        break;
    if ((i < *argcp)
        && (GetDefaultValue (DEFAULTSFILENAME, UGDEBUGRFILE, buffer) == 0)
        && (sscanf (buffer, " %s ", debugfilename) == 1))
    {
      if (SetPrintDebugToFile (debugfilename) != 0)
      {
        printf ("ERROR while opening debug file '%s'\n", debugfilename);
        printf ("aborting ug\n");
        return (1);
      }
      UserWriteF ("debug info is captured to file '%s'\n", debugfilename);
    }
    else
    {
      SetPrintDebugProc (printf);
      UserWriteF ("debug info is printed to stdout\n");
    }
  }
#endif

  /* init the domain module */
  if ((err = InitDom ()) != 0)
  {
    printf
      ("ERROR in InitDom while InitDom (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }

  /* init the gm module */
  if ((err = InitGm ()) != 0)
  {
    printf
      ("ERROR in InitUg while InitGm (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }

  /* init the numerics module */
  if ((err = InitNumerics ()) != 0)
  {
    printf
      ("ERROR in InitUg while InitNumerics (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }

  /* init the ui module */
  if ((err = InitUi (argcp[0], argvp[0])) != 0)
  {
    printf
      ("ERROR in InitUg while InitUi (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }

  /* init the graphics module */
  if ((err = InitGraphics ()) != 0)
  {
    printf
      ("ERROR in InitUg while InitGraphics (line %d): called routine line %d\n",
      (int) HiWrd (err), (int) LoWrd (err));
    printf ("aborting ug\n");

    return (1);
  }

  return (0);
}
Пример #24
0
HTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue)
{
  GetDefaultValue(aValue);
}
Пример #25
0
wxString PluginPreference::GetValue() {
  if (hasBeenSet_) return value_;
  return GetDefaultValue();
}
Пример #26
0
 static void Check( T*& ptr)
 {
     if (! ptr) ptr = GetDefaultValue();
 }