/** Configuration_configure * Set RTC's configuration value. * -address: IP address of naming service. * -componentName: name of component. this should include naming context. * -confSetName: configuration_set's name * -confName: configuration name. * -retval : return value for scilab process. * If success, *retval will be zero. * if failed *retval will be non-zero value */ EXPORT_FUNCTION_TYPE Configuration_configure(const int *Handle, const char* confSetName, const char* confName, const char* confValue, int* retval) { ConvertDmyStr(confSetName); ConvertDmyStr(confName); ConvertDmyStr(confValue); RTC::CorbaConsumer<RTC::RTObject> corbaConsumer; CORBA::Object_ptr object; if((object=Resolve(*Handle)) == 0) { err("Resolving Corba Consumer failed."); *retval = -1; return; } corbaConsumer.setObject(object); SDOPackage::Configuration_ptr pConf = corbaConsumer->get_configuration(); SDOPackage::ConfigurationSetList *pConfSetList = pConf->get_configuration_sets(); for(unsigned int i = 0;i < pConfSetList->length();i++) { if( ((std::string)((*pConfSetList)[i].id)) == confSetName ){ SDOPackage::ConfigurationSet* pConfSet = pConf->get_configuration_set(confSetName); std::string str; coil::Properties props = NVUtil::toProperties(pConfSet->configuration_data); for(int j = 0;j < props.size();j++) { if( ((std::string)(pConfSet->configuration_data[j].name)) == confName) { //props.removeNode(confName); props.setProperty(confName, confValue); RTC::NVList list; NVUtil::copyFromProperties(list, props); pConfSet->configuration_data = list; pConf->set_configuration_set_values(*pConfSet); pConf->activate_configuration_set(confSetName); *retval = 0;return; } } } } err("Failed to find configuration(%s) in RTC", confName); *retval = -2; }
void GSDevice::Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c) { if(m_merge == NULL || m_merge->GetSize() != fs) { Recycle(m_merge); m_merge = CreateRenderTarget(fs.x, fs.y, false); } // TODO: m_1x1 // KH:COM crashes at startup when booting *through the bios* due to m_merge being NULL. // (texture appears to be non-null, and is being re-created at a size around like 1700x340, // dunno if that's relevant) -- air if(m_merge) { GSTexture* tex[2] = {NULL, NULL}; for(size_t i = 0; i < countof(tex); i++) { if(sTex[i] != NULL) { tex[i] = sTex[i]->IsMSAA() ? Resolve(sTex[i]) : sTex[i]; } } DoMerge(tex, sRect, m_merge, dRect, slbg, mmod, c); for(size_t i = 0; i < countof(tex); i++) { if(tex[i] != sTex[i]) { Recycle(tex[i]); } } } else { printf("GSdx: m_merge is NULL!\n"); } m_current = m_merge; }
bool CRenderTarget::Create(const frameInfo& frame) { FUNCLOG Resolve(); Destroy(); created = 123; lastused = timeGetTime(); fbp = frame.fbp; fbw = frame.fbw; fbh = frame.fbh; psm = (u8)frame.psm; fbm = frame.fbm; vposxy.x = 2.0f * (1.0f / 8.0f) / (float)fbw; vposxy.y = 2.0f * (1.0f / 8.0f) / (float)fbh; vposxy.z = -1.0f - 0.5f / (float)fbw; vposxy.w = -1.0f + 0.5f / (float)fbh; status = 0; if (fbw > 0 && fbh > 0) { GetRectMemAddressZero(start, end, psm, fbw, fbh, fbp, fbw); psys = _aligned_malloc(Tex_Memory_Size(fbw, fbh), 16); GL_REPORT_ERRORD(); if (!InitialiseDefaultTexture(&ptex, RW(fbw), RH(fbh))) { Destroy(); return false; } status = TS_NeedUpdate; } else { start = end = 0; } return true; }
/** ConfigurationSet_getConfNameList * Get RTC's configuration names. * -address: IP address of naming service. * -componentName: name of component. this should include naming context. * -confSetName: configuration_set's name * -retval : return value for scilab process. * If success, *retval will be the name list of configuration. * each name is separated by the RTCSCILAB_DELIMITER. * if failed *retval will be "failed" */ EXPORT_FUNCTION_TYPE ConfigurationSet_getConfNameList(const int *Handle, const char* confSetName, char* confNameList) { ConvertDmyStr(confSetName); info("ConfigurationSet_getConfNameList(%s)", confSetName); RTC::CorbaConsumer<RTC::RTObject> corbaConsumer; CORBA::Object_ptr object; if((object=Resolve(*Handle)) == 0) { err("Resolving Corba Consumer failed."); strcpy(confNameList, "failed");return; } corbaConsumer.setObject(object); SDOPackage::Configuration_ptr pConf = corbaConsumer->get_configuration(); SDOPackage::ConfigurationSetList *pConfSetList = pConf->get_configuration_sets(); for(unsigned int i = 0;i < pConfSetList->length();i++) { info("persing confset(%s)", (*pConfSetList)[i].id); if( ((std::string)((*pConfSetList)[i].id)) == confSetName ){ std::string str; coil::Properties props = NVUtil::toProperties((*pConfSetList)[i].configuration_data); for(int j = 0;j < props.size();j++) { str += (*pConfSetList)[i].configuration_data[j].name; str += RTCSCILAB_DELIMITER; str += RTCSCILAB_DMYSTR + props[((std::string)(*pConfSetList)[i].configuration_data[j].name).c_str()]; str += RTCSCILAB_DELIMITER; // Memo: 2010/02/28 // The RTCSCILAB_DMYSTR is strictly needed because the property allows empty value. // if empty value is passed to scilab, error occurs. // This error occurs because I use space to separate values and names of property. // I guess if I use "," or ";" for delimiter, the error will be erased. } strcpy(confNameList, str.c_str()); info("match."); return; } } strcpy(confNameList, "failed"); }
JSBool XPCNativeMember::NewFunctionObject(XPCCallContext& ccx, XPCNativeInterface* iface, JSObject *parent, jsval* pval) { NS_ASSERTION(!IsConstant(), "Only call this if you're sure this is not a constant!"); if(!IsResolved() && !Resolve(ccx, iface)) return JS_FALSE; AUTO_MARK_JSVAL(ccx, &mVal); JSObject* funobj = xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(mVal), parent); if(!funobj) return JS_FALSE; *pval = OBJECT_TO_JSVAL(funobj); return JS_TRUE; }
void Combat::resolve() { bs::Battle battle; setup(battle); // Simulate LOG("Owners entering battle: %lu", m_ownerToIndex.size()); auto sim = std::make_unique<bs::BattleSim>(battle); sim->Resolve(); LOG("Total battle length %f seconds", static_cast<double>(battle.TotalTimeMS()) / 1000.0 ) for (size_t i = 0; i < m_commanders.size(); i++) { auto& cmdr = m_commanders[i]; auto& unit = battle.Get(i); Status status; status.hitpoints = unit.hitpoints; LOG("Commander %zu (team=%u) hitpoints=%u/%u", i, cmdr.owner, status.hitpoints, cmdr.reference->hp); m_status.emplace_back(status); } }
void ReadModule::Connect(std::string source, std::string target) { pthread_mutex_lock(&cmdMutex); zmq::socket_t *s = GetSocket(source); if (s == NULL) { pthread_mutex_unlock(&cmdMutex); return; } pns_record t_record; t_record.name = "/resolve" + target; Resolve(t_record); std::stringstream ss; ss.clear(); ss.str(""); ss << "tcp://" << t_record.host << ":" << t_record.port; std::string sock = ss.str(); std::cout << "Connect to socket " << sock << std::endl; try { s->connect(sock.c_str()); } catch (zmq::error_t &e) { std::cerr << "Error: Could not connect to " << target << ", because: " << e.what() << std::endl; } pthread_mutex_unlock(&cmdMutex); }
ImageHandle FreeTypeFont::createGlyphImage(int codepoint, int fontSize) const { int glyph_index = FT_Get_Char_Index( fontInfo->face, codepoint ); int error = FT_Set_Pixel_Sizes( fontInfo->face, /* handle to face object */ 0, /* pixel_width */ fontSize ); /* pixel_height */ if ( error ) LogError("Error setting font size"); error = FT_Load_Glyph( fontInfo->face, glyph_index, FT_LOAD_RENDER | FT_LOAD_TARGET_LCD); if ( error ) LogError("Error loading glyph"); FT_Glyph glyph; /* a handle to the glyph image */ error = FT_Get_Glyph( fontInfo->face->glyph, &glyph ); if ( error ) LogError("Error getting glyph"); FT_Vector origin; origin.x = origin.y = 0; error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_LCD, &origin, 1 ); FT_Bitmap bitmap = ((FT_BitmapGlyph) glyph)->bitmap; if (bitmap.width == 0 || bitmap.rows == 0) return HandleInvalid; auto image = ImageCreate(AllocatorGetHeap(), bitmap.width/3, bitmap.rows, PixelFormat::R8G8B8); image.Resolve()->setBuffer(bitmap.buffer, bitmap.pitch); return image; }
v8::Handle<v8::Promise> Meal::cook(const std::string& chefName, v8::Isolate* isolate) { using ResolverPersistent = Nan::Persistent<v8::Promise::Resolver>; auto period = 3000; // In ms auto resolver = v8::Promise::Resolver::New(isolate); auto persistent = new ResolverPersistent(resolver); struct MealData { Meal* myself; ResolverPersistent* persistent; }; uv_timer_t* handle = new uv_timer_t; handle->data = new MealData{this, persistent}; uv_timer_init(uv_default_loop(), handle); // use capture-less lambda for c-callback auto timercb = [](uv_timer_t* handle) -> void { Nan::HandleScope scope; auto persistent = static_cast<MealData*>(handle->data)->persistent; auto myself = static_cast<MealData*>(handle->data)->myself; delete static_cast<MealData*>(handle->data); uv_timer_stop(handle); uv_close(reinterpret_cast<uv_handle_t*>(handle), [](uv_handle_t* handle) -> void {delete handle;}); myself->raw_meal_ = false; auto resolver = Nan::New(*persistent); resolver->Resolve(Nan::New("Microwave Ding").ToLocalChecked()); persistent->Reset(); delete persistent; }; uv_timer_start(handle, timercb, period, 0); return resolver->GetPromise(); }
GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format, int ps_shader) { GSTexture* dst = NULL; if(format == 0) { format = DXGI_FORMAT_R8G8B8A8_UNORM; } if(format != DXGI_FORMAT_R8G8B8A8_UNORM && format != DXGI_FORMAT_R16_UINT) { ASSERT(0); return false; } if(GSTexture* rt = CreateRenderTarget(w, h, false, format)) { GSVector4 dRect(0, 0, w, h); if(GSTexture* src2 = src->IsMSAA() ? Resolve(src) : src) { StretchRect(src2, sRect, rt, dRect, m_convert.ps[format == DXGI_FORMAT_R16_UINT ? 1 : 0], NULL); if(src2 != src) Recycle(src2); } dst = CreateOffscreen(w, h, format); if(dst) { m_ctx->CopyResource(*(GSTexture11*)dst, *(GSTexture11*)rt); } Recycle(rt); } return dst; }
std::pair< TokIdNode *, int > TokIdNode::Resolve( TokIdNode const *node, std::deque< TokId >::const_iterator arr, int len, Matcher const &hard_matcher, TokIdNode const *hard_context, TokIdNode const *soft_context, TokIdNode const *subroot) { std::vector< std::pair< TokIdNode *, int > > rv; if(!hard_context->IsInContext(subroot)) { PNL_THROW(pnl::CBadArg, "hard_context must lie in subtree rooted at subroot"); } if(!soft_context->IsInContext(hard_context)) { soft_context = hard_context; } rv = AmbigResolve(node, arr, len, hard_matcher, soft_context, subroot); if(rv.empty()) { if(soft_context != hard_context) { return Resolve(node, arr, len, hard_matcher, hard_context, soft_context->v_prev, subroot); } return std::make_pair((TokIdNode *)node, 0); } if(rv.size() > 1) { return std::make_pair((TokIdNode *)node, 0); } return rv[0]; }
/* * vislib::sys::Path::PurgeDirectory */ void vislib::sys::Path::PurgeDirectory(const StringW& path, bool recursive) { StringW fullpath = Resolve(path); if (!fullpath.EndsWith(SEPARATOR_W)) fullpath += SEPARATOR_W; DirectoryIteratorW iter(fullpath); while (iter.HasNext()) { DirectoryEntryW entry = iter.Next(); if (entry.Type == DirectoryEntryW::FILE) { vislib::sys::File::Delete(fullpath + entry.Path); } else if (entry.Type == DirectoryEntryW::DIRECTORY) { if (recursive) { DeleteDirectory(fullpath + entry.Path, true); } } else { ASSERT(false); // DirectoryEntry is something unknown to this // implementation. Check DirectoryIterator for // changes. } } }
/* AString getAttribute (in nsIAtom name); */ NS_IMETHODIMP xgGtkElement::GetAttribute (nsIAtom *name, nsAString &_retval) { GParamSpec *spec; guint signal_id; if (!Resolve (name, &spec, &signal_id)) { return NS_ERROR_FAILURE; } if (!spec) { return NS_ERROR_FAILURE; } GValue gval = { 0 }; g_value_init (&gval, G_TYPE_STRING); g_object_get_property (G_OBJECT (mObject), spec->name, &gval); if (G_VALUE_HOLDS (&gval, G_TYPE_STRING)) { _retval = NS_ConvertUTF8toUTF16 (nsCAutoString (g_value_get_string (&gval))); g_value_unset (&gval); return NS_OK; } g_value_unset (&gval); return NS_ERROR_FAILURE; }
//----------------------------------------- void CPUTRenderTargetColor::RestoreRenderTarget( CPUTRenderParameters &renderParams ) { ASSERT( mRenderTargetSet, "Render target restored without calling SetRenderTarget()"); if( mMultiSampleCount>1 ) { Resolve( renderParams ); } ID3D11DeviceContext *pContext = CPUT_DX11::GetContext(); pContext->OMSetRenderTargets( 1, &mpSavedColorRenderTargetView, mpSavedDepthStencilView ); CPUTRenderTargetColor::SetActiveWidthHeight( mSavedWidth, mSavedHeight ); CPUTRenderTargetDepth::SetActiveWidthHeight( mSavedWidth, mSavedHeight ); CPUTRenderTargetColor::SetActiveRenderTargetView( mpSavedColorRenderTargetView ); CPUTRenderTargetDepth::SetActiveDepthStencilView( mpSavedDepthStencilView ); // TODO: save/restore original VIEWPORT settings, not assume full-screen viewport. D3D11_VIEWPORT viewport = { 0.0f, 0.0f, (float)mSavedWidth, (float)mSavedHeight, 0.0f, 1.0f }; CPUT_DX11::GetContext()->RSSetViewports(1, &viewport); mRenderTargetSet = false; } // CPUTRenderTarget::RestoreRenderTarget()
void Resolver::Resolve(const std::string& hostname, int32_t port) { this->hostname = hostname; this->port = port; return Resolve(); }
const Point& RLoc::Location() { if (rloc || dex > 0) Resolve(); return loc; }
void SideFriction::Stop_Delay (void) { int stop, stops, run, runs, dir, route, period, lane, ln, time; int stop_id, offset, low, high, length, start, link_dir, num; char buffer [FIELD_BUFFER]; Stop_Data *stop_ptr; Line_Data *line_ptr; Link_Data *link_ptr; Dir_Data *dir_ptr; Offset_Data *offset_ptr; Link_Use_Data *use_ptr; Show_Message ("Estimate Transit Stop Delay -- Route"); Set_Progress (100); //---- read each route ---- for (line_ptr = line_data.First_Key (); line_ptr; line_ptr = line_data.Next_Key ()) { Show_Progress (); route = line_ptr->Route (); stops = line_ptr->Stops (); runs = line_ptr->Runs (); if (route_flag) { if (!select_routes.In_Range (route)) continue; } if (!select_modes [line_ptr->Mode ()]) continue; for (stop=1; stop <= stops; stop++) { stop_id = line_ptr->Stop (stop); //---- check for stop in the subarea ---- if (subarea_flag) { offset_ptr = stop_offset.Get (stop_id); if (offset_ptr == NULL) continue; if (!In_Polygon (offset_ptr->X (), offset_ptr->Y (), &select_subarea.points)) continue; } //---- find the stop link ---- stop_ptr = stop_data.Get (stop_id); if (stop_ptr == NULL) { Warning ("Route %d Stop %d was Not Found", route, line_ptr->Stop (stop)); continue; } link_ptr = link_data.Get (stop_ptr->Link ()); if (link_ptr == NULL) { Warning ("Stop Link %d was Not Found", stop_ptr->Link ()); continue; } if (stop_ptr->Dir () == 0) { dir = link_ptr->AB_Dir (); offset = stop_ptr->Offset (); low = link_ptr->Aoffset (); high = link_ptr->Boffset (); } else { dir = link_ptr->BA_Dir (); offset = link_ptr->Length () - stop_ptr->Offset (); low = link_ptr->Boffset (); high = link_ptr->Aoffset (); } dir_ptr = dir_data [dir]; if (dir_ptr == NULL) { Warning ("Stop Link %d Direction %d was Not Found", stop_ptr->Link (), stop_ptr->Dir ()); continue; } link_dir = stop_ptr->Link_Dir (); lane = dir_ptr->Left () + dir_ptr->Thru (); high = link_ptr->Length () - high; length = stop_length; offset -= length; if (offset < low) { offset = low; if (offset + length > high) length = high - offset; } else if (offset + length > high) { offset = high - length; if (offset < low) { offset = low; length = high - low; } } //---- add a lane blockage for each run ---- for (run=1; run < runs; run++) { time = Resolve (line_ptr->Schedule (run, stop)); period = transit_periods.In_Index (time); if (period == 0) continue; start = time - Resolve (stop_times [period]); if (start < 0) start = 0; ln = lane; if (dir_ptr->TOD_List () > 0) { for (num = dir_ptr->TOD_List (); num; num = use_ptr->TOD_List ()) { use_ptr = link_use_data [num]; if (use_ptr->Length () > 0) continue; if (use_ptr->Low_Lane () > lane || lane > use_ptr->High_Lane ()) continue; if (Use_Permission (use_ptr->Use (), BUS)) continue; if (use_ptr->End () < Round (start) || use_ptr->Start () > Round (time)) continue; ln = use_ptr->Low_Lane () - 1; break; } } if (ln <= dir_ptr->Left ()) continue; new_file->Link (stop_ptr->Link ()); new_file->Dir (stop_ptr->Dir ()); new_file->Lane (ln); new_file->Use (Use_Code (Use_Code ("BUS"))); new_file->Type (Restrict_Code (ONLY)); new_file->Start (time_step.Format_Step (start)); new_file->End (time_step.Format_Step (time)); new_file->Offset (UnRound (offset)); new_file->Length (UnRound (length)); str_fmt (buffer, sizeof (buffer), "Route %d Stop %d Run %d", route, stop_id, run); new_file->Notes (buffer); if (!new_file->Write ()) { Error ("Writing %s", new_file->File_Type ()); } new_use++; } } } End_Progress (); }
void ArcNet::Draw_Route (void) { int i, j, num_legs, stop, stops, link_dir, dir_index, dir, overlap, runs; int route_field, stops_field, mode_field, type_field, name_field, notes_field; double offset, length, stop_off, link_len, side, side_offset; bool offset_flag; Db_Base *file; file = System_File_Base (TRANSIT_ROUTE); route_field = file->Required_Field (ROUTE_FIELD_NAMES); stops_field = file->Required_Field ("STOPS", "NSTOPS", "NUM_STOPS"); mode_field = file->Required_Field (MODE_FIELD_NAMES); type_field = file->Optional_Field ("TYPE", "VEHTYPE", "VEH_TYPE"); name_field = file->Optional_Field ("NAME", "ROUTE_NAME", "RTNAME", "DESCRIPTION"); notes_field = file->Optional_Field ("NOTES"); Link_Data *link_ptr; Dir_Data *dir_ptr; Link_Itr link_itr; Line_Itr line_itr; XYZ_Point point; Int_Map_Itr map_itr; Points_Itr pt_itr; Point_Map_Itr stop_pt_itr; Line_Stop_Itr stop_itr; Line_Run_Itr run_itr; Stop_Data *stop_ptr; Show_Message ("Draw Transit Route -- Record"); Set_Progress (); offset_flag = (route_offset != 0.0); side = 0.0; stop = 1; //---- set the overlap count ---- if (!overlap_flag) { for (link_itr = link_array.begin (); link_itr != link_array.end (); link_itr++) { link_itr->Aoffset (0); link_itr->Boffset (0); } } //---- process each transit route ---- for (line_itr = line_array.begin (); line_itr != line_array.end (); line_itr++) { Show_Progress (); stops = (int) line_itr->size (); arcview_route.Put_Field (route_field, line_itr->Route ()); arcview_route.Put_Field (mode_field, line_itr->Mode ()); arcview_route.Put_Field (type_field, line_itr->Type ()); arcview_route.Put_Field (stops_field, stops); arcview_route.Put_Field (name_field, line_itr->Name ()); arcview_route.Put_Field (notes_field, line_itr->Notes ()); stop_itr = line_itr->begin (); arcview_route.Put_Field ("NUM_RUNS", (int) stop_itr->size ()); //---- save the number of runs in each period ---- if (schedule_flag) { for (i=1; i <= sched_breaks.Num_Ranges (); i++) { runs = 0; for (run_itr = stop_itr->begin (); run_itr != stop_itr->end (); run_itr++) { if (sched_breaks.In_Index (Resolve (run_itr->Schedule ())) == i) { runs++; } } arcview_route.Put_Field (run_field + i, runs); } } //---- create the route shape ---- arcview_route.clear (); if (driver_flag) { num_legs = (int) line_itr->driver_array.size (); arcview_route.Put_Field ("NUM_LINKS", num_legs); //---- find the end index ---- stop_itr = --(line_itr->end ()); stop_ptr = &stop_array [stop_itr->Stop ()]; map_itr = dir_map.find (stop_ptr->Link_Dir ()); dir_index = map_itr->second; for (i=num_legs - 1; i >= 0; i--) { if (dir_index == line_itr->driver_array [i]) break; } if (i < 0) goto path_error; num_legs = i; //---- find the start index ---- stop_itr = line_itr->begin (); stop_ptr = &stop_array [stop_itr->Stop ()]; map_itr = dir_map.find (stop_ptr->Link_Dir ()); dir_index = map_itr->second; for (i=0; i <= num_legs; i++) { if (dir_index == line_itr->driver_array [i]) break; } if (i > num_legs) goto path_error; //---- create transit legs ---- for (j=1; i <= num_legs; i++) { dir_index = line_itr->driver_array [i]; dir_ptr = &dir_array [dir_index]; dir = dir_ptr->Dir (); link_dir = dir_ptr->Link_Dir (); link_ptr = &link_array [dir_ptr->Link ()]; link_len = UnRound (link_ptr->Length ()); side_offset = route_offset; if (offset_flag) { if (!overlap_flag) { if (dir == 0) { overlap = link_ptr->Aoffset () + 1; link_ptr->Aoffset (overlap); } else { overlap = link_ptr->Boffset () + 1; link_ptr->Boffset (overlap); } side = side_offset *= overlap; } else if (link_ptr->AB_Dir () >= 0 && link_ptr->BA_Dir () >= 0) { side = side_offset; } else { side = 0.0; } } if (side_offset > link_len / 3.0) { side_offset = link_len / 3.0; } offset = side_offset; //---- check for stops ---- while (stop_ptr->Link_Dir () == link_dir) { stop_off = UnRound (stop_ptr->Offset ()); length = stop_off - offset; Link_Shape (link_ptr, dir, points, offset, length, side); offset = stop_off; if (j != 1) { //---- draw the link to the stop ---- pt_itr = points.begin (); if (side == 0.0 && pt_itr != points.end ()) { pt_itr++; } for (; pt_itr != points.end (); pt_itr++) { arcview_route.push_back (*pt_itr); } pt_itr = --points.end (); } else { pt_itr = points.begin (); } stop_pt_itr = stop_pt.find (stop_ptr->Stop ()); if (stop_pt_itr != stop_pt.end ()) { arcview_route.push_back (stop_pt_itr->second); } //---- find the next stop ----- if (++j > stops) break; arcview_route.push_back (*pt_itr); stop_itr++; stop = stop_itr->Stop (); stop_ptr = &stop_array [stop]; } //---- complete the link ---- if (i < num_legs) { length = link_len - offset - side_offset; Link_Shape (link_ptr, dir, points, offset, length, side); pt_itr = points.begin (); if (!offset_flag) { pt_itr++; } for (; pt_itr != points.end (); pt_itr++) { arcview_route.push_back (*pt_itr); } } } } else { for (stop_itr = line_itr->begin (); stop_itr != line_itr->end (); stop_itr++) { stop_ptr = &stop_array [stop_itr->Stop ()]; stop_pt_itr = stop_pt.find (stop_ptr->Stop ()); if (stop_pt_itr == stop_pt.end ()) goto stop_error; arcview_route.push_back (stop_pt_itr->second); } } if (!arcview_route.Write_Record ()) { Error (String ("Writing %s") % arcview_route.File_Type ()); } } End_Progress (); arcview_route.Close (); return; stop_error: Error (String ("Route %d Stop %d was Not Found in the Stop File") % line_itr->Route () % stop); path_error: Error (String ("Route %d Stop %d was Not Found on Driver Path") % line_itr->Route () % stop_ptr->Stop ()); }
VExpression* VArrayElement::ResolveAssignmentTarget(VEmitContext& ec) { IsAssign = true; return Resolve(ec); }
/* * vislib::sys::Path::DeleteDirectory */ void vislib::sys::Path::DeleteDirectory(const StringA& path, bool recursive) { if (!File::Exists(path)) return; // we don't delete non-existing stuff StringA fullPath = Resolve(path); if (!fullPath.EndsWith(SEPARATOR_A)) fullPath += SEPARATOR_A; if (recursive) { // remove files and directory PurgeDirectory(fullPath, true); } #ifdef _WIN32 if (RemoveDirectoryA(fullPath) == 0) { #else /* _WIN32 */ if (rmdir(fullPath) != 0) { #endif /* _WIN32 */ throw vislib::sys::SystemException(__FILE__, __LINE__); } } /* * vislib::sys::Path::DeleteDirectory */ void vislib::sys::Path::DeleteDirectory(const StringW& path, bool recursive) { #ifdef _WIN32 if (!File::Exists(path)) return; // we don't delete non-existing stuff StringW fullPath = Resolve(path); if (!fullPath.EndsWith(SEPARATOR_W)) fullPath += SEPARATOR_W; if (recursive) { // remove files and directory PurgeDirectory(fullPath, true); } if (RemoveDirectoryW(fullPath) == 0) { throw vislib::sys::SystemException(__FILE__, __LINE__); } #else /* _WIN32 */ // linux is stupid DeleteDirectory(W2A(path), recursive); #endif /* _WIN32 */ } /* * vislib::sys::Path::FindExecutablePath */ vislib::StringA vislib::sys::Path::FindExecutablePath( const vislib::StringA& filename) { #ifdef _WIN32 bool found = false; DWORD bufSize = MAX_PATH; char *buffer = new char[bufSize]; // first try: "SearchPath" DWORD rv = ::SearchPathA(NULL, filename.PeekBuffer(), NULL, bufSize, buffer, NULL); if (rv > 0) { found = true; if (rv + 1 > bufSize) { bufSize = rv + 1; delete[] buffer; buffer = new char[bufSize]; rv = ::SearchPathA(NULL, filename.PeekBuffer(), NULL, bufSize, buffer, NULL); if (rv == 0) { // failed found = false; } } } if (!found) { // second try: "AssocQueryString" // NOTE: // AssocQueryString does not work as specified! It is not possible to ask // for the size of the string buffer holding the value returned. Therefore // this implementation increases the buffersize until the returned strings // no longer grow. DWORD bufLen = MAX_PATH; HRESULT hr; bufSize = MAX_PATH; do { hr = ::AssocQueryStringA(ASSOCF_INIT_BYEXENAME, ASSOCSTR_EXECUTABLE, filename.PeekBuffer(), NULL, buffer, &bufSize); if ((hr != E_POINTER) && (hr != S_OK)) { // error break; } if (bufSize == bufLen) { bufLen += MAX_PATH; bufSize = bufLen; delete[] buffer; buffer = new char[bufSize]; } else { found = true; } } while (bufSize == bufLen); } if (found) { vislib::StringA retval(buffer); delete[] buffer; return retval; } else { return ""; } #else /* _WIN32 */ // Note: // Do not use "Console::Run" or "Process" methods because they might use // this method to determine the full path of their binaries. So we avoid // calling cycles by just using "popen" directly vislib::StringA cmd("which "); vislib::StringA ret; cmd += filename; cmd += " 2> /dev/null"; const int bufferSize = 1024; char buffer[bufferSize]; FILE *which = ::popen(cmd.PeekBuffer(), "r"); if (which == NULL) { return ""; } while (!::feof(which)) { ret += fgets(buffer, bufferSize, which); } ::pclose(which); vislib::StringA::Size end = ret.Find('\n'); if (end != vislib::StringA::INVALID_POS) { ret.Truncate(end); } if (ret.EndsWith(filename)) { return ret; } else { return ""; } #endif /* _WIN32 */ }
void TransitNet::Write_Route (void) { int i, j, stop, time; bool new_flag; Line_Data *line_ptr; Stop_Data *stop_ptr; Link_Data *link_ptr; Line_File *line_file = (Line_File *) Network_Db_Base (NEW_TRANSIT_ROUTE); Schedule_File *schedule_file = (Schedule_File *) Network_Db_Base (NEW_TRANSIT_SCHEDULE); //---- write the route and schedule file ---- Show_Message ("Writing %s -- Record", line_file->File_Type ()); Set_Progress (1000); for (line_ptr = line_data.First_Key (); line_ptr; line_ptr = line_data.Next_Key ()) { Show_Progress (); new_flag = (edit_list.Get_Index (line_ptr->Route ()) != 0); //---- write the route file ---- line_file->Route (line_ptr->Route ()); line_file->Stops (line_ptr->Stops ()); line_file->Mode (Transit_Code ((Transit_Type) line_ptr->Mode ())); line_file->Name ((char *) line_ptr->Name ()); line_file->Notes ((char *) line_ptr->Notes ()); if (!line_file->Write (false)) goto line_error; nroute++; if (new_flag) route_edit++; for (i=1; i <= line_ptr->Stops (); i++) { stop = line_ptr->Stop (i); line_file->Stop (stop); stop_ptr = stop_data.Get (stop); if (line_file->LinkDir_Type () == LINK_NODE) { line_file->Link (stop_ptr->Link ()); link_ptr = link_data.Get (stop_ptr->Link ()); if (stop_ptr->Dir () > 0) { line_file->Node (link_ptr->Anode ()); } else { line_file->Node (link_ptr->Bnode ()); } } else if (line_file->LinkDir_Type () == LINK_DIR) { line_file->Link (stop_ptr->Link ()); line_file->Node (stop_ptr->Dir ()); } else { if (stop_ptr->Dir () > 0) { line_file->Link (-(stop_ptr->Link ())); } else { line_file->Link (stop_ptr->Link ()); } line_file->Node (0); } line_file->Zone (line_ptr->Zone (i)); line_file->Time_Flag (line_ptr->Time_Flag (i)); if (!line_file->Write (true)) goto line_error; nroute++; if (new_flag) route_edit++; } //---- write the schedule file ---- schedule_file->Route (line_ptr->Route ()); for (i=1; i <= line_ptr->Runs (); i++) { for (j=1; j <= line_ptr->Stops (); j++) { stop = line_ptr->Stop (j); time = line_ptr->Schedule (i, j); schedule_file->Time (Resolve (time)); schedule_file->Stop (stop); if (!schedule_file->Write ()) { Error ("Writing %s", schedule_file->File_Type ()); } nschedule++; if (new_flag) schedule_edit++; } } } End_Progress (); line_file->Close (); schedule_file->Close (); return; line_error: Error ("Writing %s", line_file->File_Type ()); }
JBoolean JXSelectionData::Convert ( const Atom requestType, Atom* returnType, unsigned char** data, JSize* dataLength, JSize* bitsPerBlock ) const { JXSelectionManager* selMgr = GetSelectionManager(); // TARGETS if (requestType == selMgr->GetTargetsXAtom()) { const JSize atomCount = itsTypeList->GetElementCount(); assert( atomCount > 0 ); *returnType = XA_ATOM; *bitsPerBlock = sizeof(Atom)*8; *dataLength = sizeof(Atom)*atomCount; *data = new unsigned char [ *dataLength ]; if (*data == NULL) { return kJFalse; } Atom* atomData = reinterpret_cast<Atom*>(*data); for (JIndex i=1; i<=atomCount; i++) { atomData[i-1] = itsTypeList->GetElement(i); } return kJTrue; } // TIMESTAMP else if (requestType == selMgr->GetTimeStampXAtom()) { *returnType = XA_INTEGER; *bitsPerBlock = sizeof(Time)*8; *dataLength = sizeof(Time); *data = new unsigned char [ *dataLength ]; if (*data == NULL) { return kJFalse; } *(reinterpret_cast<Time*>(*data)) = itsStartTime; return kJTrue; } // everything else else { Resolve(); return ConvertData(requestType, returnType, data, dataLength, bitsPerBlock); } }
void LinkSum::Top_100_Ratios (int type) { int i, j, k, num, anode, bnode, min_ratio, ratio, tod_list, tod, lanes; int load, base, cap, capacity, tim, vol, time0, len; Link_Data *link_ptr; Performance_Data *perf_ptr; Link_Use_Data *use_ptr; Range_Data *range_ptr; //---- Top 100 Ratio Report Data ---- typedef struct { int link; int from; int to; int period; int base; int load; int ratio; } Ratio_Data; Ratio_Data ratios [100], *ptr; Show_Message ("Creating the Top 100 Ratios Report -- Record"); Set_Progress (10000); memset (ratios, '\0', 100 * sizeof (Ratio_Data)); //---- find Top 100 Ratios ---- min_ratio = 0; for (link_ptr = link_data.First (); link_ptr; link_ptr = link_data.Next ()) { Show_Progress (); if (select_flag && link_ptr->Use () == 0) continue; len = link_ptr->Length (); for (i=0; i < 2; i++) { if (i) { if (link_ptr->Use () == -1) continue; perf_ptr = performance_data [link_ptr->BA_Dir ()]; anode = link_ptr->Bnode (); bnode = link_ptr->Anode (); } else { if (link_ptr->Use () == -2) continue; perf_ptr = performance_data [link_ptr->AB_Dir ()]; anode = link_ptr->Anode (); bnode = link_ptr->Bnode (); } if (perf_ptr == NULL) continue; time0 = perf_ptr->Time0 (); if (time0 == 0) continue; capacity = cap = (int) (perf_ptr->Capacity () * cap_factor + 0.5); tod_list = perf_ptr->TOD_List (); lanes = perf_ptr->Thru (); if (lanes < 1) lanes = 1; num = perf_ptr->Periods (); //---- scan each time period ---- for (j=1; j <= num; j++) { vol = perf_ptr->Volume (j); if (vol < min_volume) continue; switch (type) { case TOP_SPEED: tim = Round (perf_ptr->TTime (j)); if (tim == 0) continue; base = (len * 10 + time0 / 2) / time0; load = (len * 10 + tim / 2) / tim; ratio = ((base - load) * 1000 + base / 2) / base; break; case TOP_TIME_RATIO: base = Resolve (time0 * 10); load = Resolve (Round (perf_ptr->TTime (j)) * 10); ratio = (load * 1000 + base / 2) / base; break; case TOP_VC_RATIO: if (tod_list > 0) { //---- get the time period ---- range_ptr = time_periods [j]; tod = Round ((range_ptr->High () + range_ptr->Low () + 1) / 2); cap = capacity; for (k = tod_list; k; k = use_ptr->TOD_List ()) { use_ptr = link_use_data [k]; if (use_ptr->Start () <= tod && tod < use_ptr->End ()) { cap = capacity * use_ptr->Lanes () / lanes; break; } } } base = cap; if (base == 0) continue; load = vol; ratio = (load * 1000 + base / 2) / base; break; case TOP_TIME_CHANGE: if (perf_ptr->Volume2 (j) < min_volume) continue; base = Resolve (Round (perf_ptr->TTime2 (j)) * 10); if (base == 0) continue; load= Resolve (Round (perf_ptr->TTime (j)) * 10); ratio = ((load - base) * 1000 + base / 2) / base; break; case TOP_VOL_CHANGE: base = perf_ptr->Volume2 (j); if (base < min_volume) continue; load = vol; ratio = ((load - base) * 1000 + base / 2) / base; break; } if (ratio > min_ratio) { ptr = ratios; for (k=0; k < 100; k++, ptr++) { if (ratio > ptr->ratio) { if (ptr->ratio > 0 && k < 99) { memmove (ptr+1, ptr, (99-k) * sizeof (Ratio_Data)); min_ratio = ratios [99].ratio; } ptr->link = link_ptr->Link (); ptr->from = anode; ptr->to = bnode; ptr->period = j; ptr->base = base; ptr->load = load; ptr->ratio = ratio; break; } } } } } } End_Progress (); //---- print the report ---- Header_Number (type); New_Page (); ptr = ratios; for (i=0; i < 100; i++, ptr++) { if (ptr->ratio == 0) break; //---- print the data record ---- Print (1, "%10ld%10ld%10ld %12.12s ", ptr->link, ptr->from, ptr->to, time_periods.Range_Format (ptr->period)); if (type == TOP_VC_RATIO) { Print (0, "%7d %7d %5.2lf", ptr->base, ptr->load, ptr->ratio / 1000.0); } else if (type == TOP_VOL_CHANGE) { Print (0, "%7d %7d %5.1lf", ptr->base, ptr->load, ptr->ratio / 10.0); } else { Print (0, "%7.1lf %7.1lf %5.1lf", ptr->base / 10.0, ptr->load / 10.0, ptr->ratio / 10.0); } } if (i) { Print (2, "Number of Records in the Report = %d", i); } Header_Number (0); }
/* * vislib::sys::Path::MakeDirectory */ void vislib::sys::Path::MakeDirectory(const StringA& path) { Stack<StringA> missingParts; StringA firstBuilt; StringA curPath = Resolve(path); while (!File::Exists(curPath)) { StringA::Size pos = curPath.FindLast(SEPARATOR_A); if (pos != StringA::INVALID_POS) { missingParts.Push(curPath.Substring(pos + 1)); if (missingParts.Peek()->IsEmpty()) { // Remove empty directories as the incremental directory // creation later on will fail for these. missingParts.Pop(); } curPath.Truncate(pos); } else { // Problem: No Separators left, but directory still does not exist. #ifdef _WIN32 throw vislib::sys::SystemException(ERROR_INVALID_NAME, __FILE__, __LINE__); #else /* _WIN32 */ throw vislib::sys::SystemException(EINVAL, __FILE__, __LINE__); #endif /* _WIN32 */ } } // curPath exists if (!File::IsDirectory(curPath)) { // the latest existing directory is not a directory (may be a file?) #ifdef _WIN32 throw vislib::sys::SystemException(ERROR_DIRECTORY, __FILE__, __LINE__); #else /* _WIN32 */ throw vislib::sys::SystemException(EEXIST, __FILE__, __LINE__); #endif /* _WIN32 */ } while (!missingParts.IsEmpty()) { curPath += SEPARATOR_A; curPath += missingParts.Pop(); #ifdef _WIN32 if (CreateDirectoryA(curPath, NULL) != 0) { #else /* _WIN32 */ if (mkdir(curPath, S_IRWXG | S_IRWXO | S_IRWXU) == 0) { // TODO: Check #endif /* _WIN32 */ // success, so go on. if (firstBuilt.IsEmpty()) { firstBuilt = curPath; } } else { DWORD errorCode = GetLastError(); try { // failure, so try to remove already created paths and throw exception. DeleteDirectory(firstBuilt, true); } catch(...) { } throw vislib::sys::SystemException(errorCode, __FILE__, __LINE__); } } // we are done! } /* * vislib::sys::Path::MakeDirectory */ void vislib::sys::Path::MakeDirectory(const StringW& path) { #ifdef _WIN32 Stack<StringW> missingParts; StringW firstBuilt; StringW curPath = Resolve(path); while (!File::Exists(curPath)) { StringW::Size pos = curPath.FindLast(SEPARATOR_W); if (pos != StringW::INVALID_POS) { missingParts.Push(curPath.Substring(pos + 1)); if (missingParts.Peek()->IsEmpty()) { // Remove empty directories as the incremental directory // creation later on will fail for these. missingParts.Pop(); } curPath.Truncate(pos); } else { // Problem: No Separators left, but directory still does not exist. throw vislib::sys::SystemException(ERROR_INVALID_NAME, __FILE__, __LINE__); } } // curPath exists if (!File::IsDirectory(curPath)) { // the latest existing directory is not a directory (may be a file?) throw vislib::sys::SystemException(ERROR_DIRECTORY, __FILE__, __LINE__); } while (!missingParts.IsEmpty()) { curPath += SEPARATOR_W; curPath += missingParts.Pop(); if (CreateDirectoryW(curPath, NULL) != 0) { // success, so go on. if (firstBuilt.IsEmpty()) { firstBuilt = curPath; } } else { DWORD errorCode = GetLastError(); try { // failure, so try to remove already created paths and throw exception. DeleteDirectory(firstBuilt, true); } catch(...) { } throw vislib::sys::SystemException(errorCode, __FILE__, __LINE__); } } // we are done! #else /* _WIN32 */ // linux is stupid MakeDirectory(W2A(path)); #endif /* _WIN32 */ }
sBool Document::OutputXCode4(mProject *pro) { sBool ok = 1; mFile *file; cVSGroup *gr; sArray<sPoolString> Frameworks; // prepare const sBool COOLLIBS = 0; bool nosetup = false; bool shell = false; for(auto con : pro->Configs) { nosetup = nosetup || (sFindFirstString(con->Name,"nosetup")!=-1); shell = shell || (sFindFirstString(con->Name,"shell")!=-1); } if(pro->Library && !nosetup) return 1; if(pro->Configs.GetCount()==0) return 1; Set("rootpath",(const sChar *)TargetRootPath); Set("library",pro->Library ? "1" : "0"); Set("compiler","make"); Set("solutiondir",pro->Name); sArray<mFile *> files; OutputFolder(pro->Root,files); if(!COOLLIBS) { for(auto dep : pro->Depends) OutputFolder(dep->Project->Root,files); } sString<sMaxPath> basepath = (const sChar *) pro->SolutionPath; sRemoveName(basepath); // gather frameworks for(auto con : pro->Configs) { for(auto gr : con->VSGroups) { if(gr->Compiler==OK_XCode4 && gr->Name.IsEmpty()) { for(auto it : gr->VSItems) { if(it->Key=="Frameworks") { const sChar *s = it->Value; while(*s==' ') s++; while(*s) { const sChar *ss = s; while(*s!=' ' && *s!=0) s++; sPoolString name(ss,s-ss); if(!Frameworks.FindEqual(name)) Frameworks.Add(name); while(*s==' ') s++; } } } } } } if(0) { for(auto pp : Frameworks) sDPrintF("(%s) ",pp); sDPrintF("\n"); } // gather files sArray<mFile *> AdditionalFiles; for(auto file : files) { if(file->ToolId == mTI_packfile) { sString<sMaxPath> buffer; buffer.PrintF("%s.pak",file->NameWithoutExtension); sASSERT(sCmpString(file->Name,file->OriginalName)==0); mFile *af = new mFile; af->Name = buffer; af->OriginalName = buffer; af->NameWithoutExtension = file->NameWithoutExtension; af->NoNew = 1; af->ToolId = mTI_pak; af->Project = file->Project; af->FullPath.PrintF("%s/%s",af->Project->SolutionPath,af->Name); AdditionalFiles.Add(af); } } for(auto file : AdditionalFiles) files.Add(file); sInt i = 1; for(auto file : files) { file->XCodeRefGuid .PrintF("%08X000000A0%08X",pro->GuidHash,i); file->XCodeFileGuid.PrintF("%08X000000A1%08X",pro->GuidHash,i); i++; } for(sInt i=0;i<files.GetCount();) { file = files[i]; if(file->Options.GetCount()) { sInt cfound = 0; sInt cexcld = 0; for(auto con : pro->Configs) { for(auto opt : file->Options) { sBool ok = 0; if(opt->Name[0]=='!') ok = !sMatchWildcard(opt->Name+1,con->Name,0,1); else ok = sMatchWildcard(opt->Name,con->Name,0,1); if(ok) { cfound++; if(opt->Excluded) cexcld++; } } } if(cfound>0 && cfound==cexcld) { files[i] = files[files.GetCount()-1]; files.RemTail(); } else { i++; } } else { i++; } } // prepare guids sString<32> guidApp ; guidApp .PrintF("%08X000000E000000001",pro->GuidHash); sString<32> guidPhaseFrameworks; guidPhaseFrameworks.PrintF("%08X000000E000000002",pro->GuidHash); sString<32> guidPhaseSources ; guidPhaseSources .PrintF("%08X000000E000000003",pro->GuidHash); sString<32> guidCopyFiles ; guidCopyFiles .PrintF("%08X000000E000000004",pro->GuidHash); sString<32> guidProducts ; guidProducts .PrintF("%08X000000E000000005",pro->GuidHash); sString<32> guidMyProject ; guidMyProject .PrintF("%08X000000E000000006",pro->GuidHash); sString<32> guidmaingroup ; guidmaingroup .PrintF("%08X000000E000000007",pro->GuidHash); sString<32> guidTarget ; guidTarget .PrintF("%08X000000E000000008",pro->GuidHash); sString<32> guidProject ; guidProject .PrintF("%08X000000E000000009",pro->GuidHash); sString<32> guidBuildTarget ; guidBuildTarget .PrintF("%08X000000E00000000A",pro->GuidHash); sString<32> guidBuildProject ; guidBuildProject .PrintF("%08X000000E00000000B",pro->GuidHash); sString<32> guidProductRef ; guidProductRef .PrintF("%08X000000E00000000C",pro->GuidHash); sString<32> guidGroupFrameworks; guidGroupFrameworks.PrintF("%08X000000E00000000D",pro->GuidHash); sString<32> guidPhaseResources ; guidPhaseResources .PrintF("%08X000000E00000000E",pro->GuidHash); sString<32> guidRuleIncbin ; guidRuleIncbin .PrintF("%08X000000E000000201",pro->GuidHash); sString<32> guidRuleAsc ; guidRuleAsc .PrintF("%08X000000E000000202",pro->GuidHash); sString<32> guidRulePackfile ; guidRulePackfile .PrintF("%08X000000E000000203",pro->GuidHash); sString<32> guidRuleOps ; guidRuleOps .PrintF("%08X000000E000000204",pro->GuidHash); // output project file (this is loooooong) sln.Clear(); sln.Print("// !$*UTF8*$!\n"); sln.Print("{\n"); sln.Print(" archiveVersion = 1;\n"); sln.Print(" classes = {\n"); sln.Print(" };\n"); sln.Print(" objectVersion = 46;\n"); sln.Print(" objects = {\n"); sln.Print("\n"); sln.Print("/* Begin PBXBuildFile section */\n"); if (!pro->Library && !shell) { if(Platform->Name=="ios") sln.Print(" 566655C616F0BE660016BA8A /* ios.info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 566655C516F0BE660016BA8A /* ios.info.plist */; };\n"); else sln.Print(" 566655C616F0BE660016BA8A /* osx.info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 566655C516F0BE660016BA8A /* osx.info.plist */; };\n"); } for(auto file : files) { switch(file->ToolId) { case mTI_cpp: case mTI_c: case mTI_m: case mTI_mm: case mTI_incbin: case mTI_packfile: case mTI_xib: case mTI_pak: case mTI_asc: case mTI_ops: case mTI_dat: case mTI_xml: sln.PrintF(" %s = {isa = PBXBuildFile; fileRef = %s /* %s */; }; \n",file->XCodeRefGuid,file->XCodeFileGuid,file->FullPath); break; default: break; } } i = 1; for(auto pp : Frameworks) { sln.PrintF(" %08X000000A2%08X = {isa = PBXBuildFile; fileRef = %08X000000A3%08X /* %s.framework */; }; \n",pro->GuidHash,i,pro->GuidHash,i,pp); i++; } if(COOLLIBS) { for(auto dep : pro->Depends) sln.PrintF(" %08X000000B8%08X = {isa = PBXBuildFile; fileRef = %08X000000B9%08X /* lib%s.a */; };\n",pro->GuidHash,dep->Project->GuidHash,pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); } sln.Print ("/* End PBXBuildFile section */\n"); sln.Print ("\n"); sln.Print ("/* Begin PBXBuildRule section */\n"); sln.PrintF(" %s /* PBXBuildRule */ = {\n",guidRuleIncbin); sln.Print (" isa = PBXBuildRule;\n"); sln.Print (" compilerSpec = com.apple.compilers.proxy.script;\n"); sln.Print (" filePatterns = \"*.incbin\";\n"); sln.Print (" fileType = pattern.proxy;\n"); sln.Print (" isEditable = 1;\n"); sln.Print (" outputFiles = (\n"); sln.Print (" \"${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}.c\",\n"); sln.Print (" );\n"); sln.PrintF (" script = \"" "cd ${INPUT_FILE_DIR}\\n" "echo %saltona2/Bin/osx/incbinasc -i=${INPUT_FILE_PATH} -o=${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}\\n" "%saltona2/Bin/osx/incbinasc -i=${INPUT_FILE_PATH} -o=${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}" "\";\n", (const char*)TargetRootPath,(const char*)TargetRootPath); sln.Print (" };\n"); sln.PrintF(" %s /* PBXBuildRule */ = {\n",guidRulePackfile); sln.Print (" isa = PBXBuildRule;\n"); sln.Print (" compilerSpec = com.apple.compilers.proxy.script;\n"); sln.Print (" filePatterns = \"*.packfile\";\n"); sln.Print (" fileType = pattern.proxy;\n"); sln.Print (" isEditable = 1;\n"); sln.Print (" outputFiles = (\n"); sln.Print (" \"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.pak\",\n"); sln.Print (" );\n"); sln.PrintF (" script = \"" "cd ${INPUT_FILE_DIR}\\n" "echo %saltona2/Bin/osx/packfile -i=${INPUT_FILE_PATH} ${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.pak\\n" "%saltona2/Bin/osx/packfile -i=${INPUT_FILE_PATH} -o=${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.pak" "\";\n", (const char*)TargetRootPath,(const char*)TargetRootPath); sln.Print (" };\n"); sln.PrintF(" %s /* PBXBuildRule */ = {\n",guidRuleAsc); sln.Print (" isa = PBXBuildRule;\n"); sln.Print (" compilerSpec = com.apple.compilers.proxy.script;\n"); sln.Print (" filePatterns = \"*.asc\";\n"); sln.Print (" fileType = pattern.proxy;\n"); sln.Print (" isEditable = 1;\n"); sln.Print (" outputFiles = (\n"); sln.Print (" \"${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}.cpp\",\n"); sln.Print (" \"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.hpp\",\n"); sln.Print (" );\n"); if(Platform->Name=="ios") { sln.PrintF (" script = \"" "cd ${INPUT_FILE_DIR}\\n" "echo %saltona2/Bin/osx/asc -i=${INPUT_FILE_PATH} -cpp=${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}.cpp -h=${INPUT_FILE_BASE}.hpp -p=gles2\\n" "%saltona2/Bin/osx/asc -i=${INPUT_FILE_PATH} -cpp=${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}.cpp -h=${INPUT_FILE_BASE}.hpp -p=gles2" "\";\n", (const char*)TargetRootPath,(const char*)TargetRootPath); } else { sln.PrintF (" script = \"" "cd \\${INPUT_FILE_DIR}\\n" "echo %saltona2/Bin/osx/asc -i=${INPUT_FILE_PATH} -cpp=${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}.cpp -h=${INPUT_FILE_BASE}.hpp -p=gl2\\n" "%saltona2/Bin/osx/asc -i=${INPUT_FILE_PATH} -cpp=${DERIVED_FILE_DIR}/${INPUT_FILE_BASE}.cpp -h=${INPUT_FILE_BASE}.hpp -p=gl2" "\";\n", (const char*)TargetRootPath,(const char*)TargetRootPath); } sln.Print (" };\n"); sln.Print ("/* End PBXBuildRule section */\n"); sln.PrintF(" %s /* PBXBuildRule */ = {\n",guidRuleOps); sln.Print (" isa = PBXBuildRule;\n"); sln.Print (" compilerSpec = com.apple.compilers.proxy.script;\n"); sln.Print (" filePatterns = \"*.ops\";\n"); sln.Print (" fileType = pattern.proxy;\n"); sln.Print (" isEditable = 1;\n"); sln.Print (" outputFiles = (\n"); sln.Print (" \"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.ops.hpp\",\n"); sln.Print (" );\n"); sln.PrintF (" script = \"" "cd ${INPUT_FILE_DIR}\\n" "echo %saltona2/Bin/osx/wz5ops -i=${INPUT_FILE_PATH} -c=${INPUT_FILE_BASE}.ops.cpp -h=${INPUT_FILE_BASE}.ops.hpp \\n" "%saltona2/Bin/osx/wz5ops -i=${INPUT_FILE_PATH} -c=${INPUT_FILE_BASE}.ops.cpp -h=${INPUT_FILE_BASE}.ops.hpp" "\";\n", (const char*)TargetRootPath,(const char*)TargetRootPath); sln.Print (" };\n"); sln.Print ("/* End PBXBuildRule section */\n"); sln.Print ("\n"); if(COOLLIBS) { sln.Print ("/* Begin PBXContainerItemProxy section */\n"); for(auto dep : pro->Depends) { sln.PrintF(" %08X000000B1%08X /* PBXContainerItemProxy */ = {\n",pro->GuidHash,dep->Project->GuidHash); sln.Print (" isa = PBXContainerItemProxy;\n"); sln.PrintF(" containerPortal = %08X000000BA%08X /* xcodeproj */;\n",pro->GuidHash,dep->Project->GuidHash); sln.Print (" proxyType = 2;\n"); sln.PrintF(" remoteGlobalIDString = %08X000000E000000001;\n",dep->Project->GuidHash); sln.PrintF(" remoteInfo = %s;\n",dep->Project->Name); sln.Print (" };\n"); sln.PrintF(" %08X000000B3%08X /* PBXContainerItemProxy */ = {\n",pro->GuidHash,dep->Project->GuidHash); sln.Print (" isa = PBXContainerItemProxy;\n"); sln.PrintF(" containerPortal = %08X000000BA%08X /* xcodeproj */;\n",pro->GuidHash,dep->Project->GuidHash); sln.Print (" proxyType = 1;\n"); sln.PrintF(" remoteGlobalIDString = %08X000000E000000008;\n",dep->Project->GuidHash); sln.PrintF(" remoteInfo = %s;\n",dep->Project->Name); sln.Print (" };\n"); } sln.Print ("/* End PBXContainerItemProxy section */\n"); sln.Print ("\n"); } sln.Print ("/* Begin PBXCopyFilesBuildPhase section */\n"); /* sln.PrintF(" %s = {\n",guidCopyFiles); sln.Print (" isa = PBXCopyFilesBuildPhase;\n"); sln.Print (" buildActionMask = 2147483647;\n"); sln.Print (" dstPath = /usr/share/man/man1/;\n"); sln.Print (" dstSubfolderSpec = 0;\n"); sln.Print (" files = (\n"); sln.Print (" );\n"); sln.Print (" runOnlyForDeploymentPostprocessing = 1;\n"); sln.Print (" };\n"); */ sln.Print ("/* End PBXCopyFilesBuildPhase section */\n"); sln.Print ("\n"); sln.Print ("/* Begin PBXFileReference section */\n"); if (!pro->Library && !shell) { if(Platform->Name=="ios") sln.Print (" 566655C516F0BE660016BA8A /* ios.info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ios.info.plist; sourceTree = \"<group>\"; };\n"); else sln.Print (" 566655C516F0BE660016BA8A /* osx.info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = osx.info.plist; sourceTree = \"<group>\"; };\n"); } i = 1; for(auto pp : Frameworks) { sln.PrintF(" %08X000000A3%08X = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = %s.framework; path = System/Library/Frameworks/%s.framework; sourceTree = SDKROOT; };\n",pro->GuidHash,i,pp,pp); i++; } if(pro->Library) sln.PrintF(" %s = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = lib%s.a; sourceTree = BUILT_PRODUCTS_DIR; };\n",guidApp,sExtractName(pro->SolutionPath)); else sln.PrintF(" %s = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = %s; sourceTree = BUILT_PRODUCTS_DIR; };\n",guidApp,sExtractName(pro->SolutionPath)); for(auto file : files) { sString<sMaxPath> buffer,from; from = pro->SolutionPath; // sRemoveName(from); sMakeRelativePath(buffer,from,file->FullPath); switch(file->ToolId) { case mTI_cpp: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; case mTI_c: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; case mTI_m: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; case mTI_mm: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objc; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; case mTI_xib: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; case mTI_hpp: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; case mTI_dat: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = file; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; case mTI_xml: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; default: sln.PrintF(" %s /* %s */ = {isa = PBXFileReference; lastKnownFileType = text; path = \"%s\"; sourceTree = \"<group>\"; };\n",file->XCodeFileGuid,file->Name,file->OriginalName); break; } } if(COOLLIBS) { for(auto dep : pro->Depends) { sString<sMaxPath> buffer,from,to; buffer = dep->Project->SolutionPath; sRemoveName(buffer); to.PrintF("%s/%s.xcodeproj",buffer,dep->Project->Name); from = pro->SolutionPath; sRemoveName(from); sMakeRelativePath(buffer,from,to); sln.PrintF(" %08X000000BA%08X = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = %s.xcodeproj; path = %s; sourceTree = \"<group>\"; };\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name,buffer); sln.PrintF(" %08X000000B9%08X = {isa = PBXFileReference; explicitFileType = archive.ar; path = lib%s.a; sourceTree = SOURCE_ROOT; };\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); } } sln.Print ("/* End PBXFileReference section */\n"); sln.Print ("\n"); sln.Print ("/* Begin PBXFrameworksBuildPhase section */\n"); sln.PrintF(" %s /* Frameworks */ = {\n",guidPhaseFrameworks); sln.Print (" isa = PBXFrameworksBuildPhase;\n"); sln.Print (" buildActionMask = 2147483647;\n"); sln.Print (" files = (\n"); i = 1; for(auto pp : Frameworks) { sln.PrintF(" %08X000000A2%08X /* %s.framework */,\n",pro->GuidHash,i,pp); i++; } if(COOLLIBS) { for(auto dep : pro->Depends) sln.PrintF(" %08X000000B8%08X /* lib%s.a */,\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); } sln.Print (" );\n"); sln.Print (" runOnlyForDeploymentPostprocessing = 0;\n"); sln.Print (" };\n"); sln.Print ("/* End PBXFrameworksBuildPhase section */\n"); sln.Print ("\n"); sln.Print ("/* Begin PBXGroup section */\n"); sln.PrintF(" %s = {\n",guidmaingroup); sln.Print (" isa = PBXGroup;\n"); sln.Print (" children = (\n"); if(COOLLIBS) { for(auto dep : pro->Depends) { sln.PrintF(" %08X000000B9%08X /* library %s */,\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); sln.PrintF(" %08X000000BA%08X /* library %s */,\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); } } else { for(auto dep : pro->Depends) sln.PrintF(" %08X000000BF%08X /* library %s */,\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); } sln.PrintF(" %s /* MyProject */,\n",guidMyProject); sln.PrintF(" %s /* Products */,\n",guidProducts); sln.PrintF(" %s /* Framworks */,\n",guidGroupFrameworks); sln.Print (" );\n"); sln.Print (" sourceTree = \"<group>\";\n"); sln.Print (" };\n"); sln.PrintF(" %s /* Products */ = {\n",guidProducts); sln.Print (" isa = PBXGroup;\n"); sln.Print (" children = (\n"); sln.PrintF(" %s /* app */,\n",guidApp); sln.Print (" );\n"); sln.Print (" name = Products;\n"); sln.Print (" sourceTree = \"<group>\";\n"); sln.Print (" };\n"); sln.PrintF(" %s /* MyProject */ = {\n",guidMyProject); sln.Print (" isa = PBXGroup;\n"); sln.Print (" children = (\n"); if (!pro->Library && !shell) { if(Platform->Name=="ios") sln.Print (" 566655C516F0BE660016BA8A /* ios.info.plist */,\n"); else sln.Print (" 566655C516F0BE660016BA8A /* osx.info.plist */,\n"); } for(auto file : files) { if(file->Project==pro) { sln.PrintF(" %s /* %s */,\n",file->XCodeFileGuid,file->Name); } } sln.Print (" );\n"); sln.PrintF(" path = %s;\n",sExtractName(pro->SolutionPath)); sln.Print (" sourceTree = \"<group>\";\n"); sln.Print (" };\n"); if(!COOLLIBS) { for(auto dep : pro->Depends) { sln.PrintF(" %08X000000BF%08X /* library %s */ = {\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); sln.Print (" isa = PBXGroup;\n"); sln.Print (" children = (\n"); for(auto file : files) { if(file->Project==dep->Project) { sln.PrintF(" %s /* %s */,\n",file->XCodeFileGuid,file->Name); } } sln.Print (" );\n"); sln.PrintF(" name = %s;\n",dep->Project->Name); sString<sMaxPath> buffer; sMakeRelativePath(buffer,basepath,dep->Project->PathName); sRemoveName(buffer); sln.PrintF(" path = %s;\n",buffer); sln.Print (" sourceTree = \"<group>\";\n"); sln.Print (" };\n"); } } if(COOLLIBS && !pro->Depends.IsEmpty()) { sln.PrintF(" %s /* Products */ = {\n",guidProductRef); sln.Print (" isa = PBXGroup;\n"); sln.Print (" children = (\n"); for(auto dep : pro->Depends) { sln.PrintF(" %08X000000BC%08X /* lib%s.a */,\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); } sln.Print (" );\n"); sln.Print (" name = Products;\n"); sln.Print (" sourceTree = \"<group>\";\n"); sln.Print (" }; \n"); } sln.PrintF(" %s /* Frameworks */ = {\n",guidGroupFrameworks); sln.Print (" isa = PBXGroup;\n"); sln.Print (" children = (\n"); i = 1; for(auto pp : Frameworks) { sln.PrintF(" %08X000000A3%08X /* %s.framework */,\n",pro->GuidHash,i,pp); i++; } sln.Print (" );\n"); sln.Print (" name = Frameworks;\n"); sln.Print (" sourceTree = \"<group>\";\n"); sln.Print (" }; \n"); sln.Print ("/* End PBXGroup section */\n"); sln.Print ("\n"); sln.Print ("/* Begin PBXNativeTarget section */\n"); sln.PrintF(" %s /* target */ = {\n",guidTarget); sln.Print (" isa = PBXNativeTarget;\n"); sln.PrintF(" buildConfigurationList = %s /* Build configuration list for PBXNativeTarget \"%s\" */;\n",guidBuildTarget,pro->Name); sln.Print (" buildPhases = (\n"); sln.PrintF(" %s /* Sources */,\n",guidPhaseSources); sln.PrintF(" %s /* Frameworks */,\n",guidPhaseFrameworks); sln.PrintF(" %s /* Resources */,\n",guidPhaseResources); // sln.PrintF(" %s /* CopyFiles */,\n",guidCopyFiles); sln.Print (" );\n"); sln.Print (" buildRules = (\n"); sln.PrintF(" %s /* incbin */,\n",guidRuleIncbin); sln.PrintF(" %s /* packfile */,\n",guidRulePackfile); sln.PrintF(" %s /* asc */,\n",guidRuleAsc); sln.PrintF(" %s /* ops */,\n",guidRuleOps); sln.Print (" );\n"); sln.Print (" dependencies = (\n"); if(COOLLIBS) { for(auto dep : pro->Depends) sln.PrintF(" %08X000000BD%08X /* lib%s.a */,\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); } sln.Print (" );\n"); sln.PrintF(" name = %s;\n",pro->Name); sln.PrintF(" productName = %s;\n",pro->Name); sln.PrintF(" productReference = %s /* app */;\n",guidApp); if(pro->Library) sln.Print (" productType = \"com.apple.product-type.library.static\";\n"); // OR APPLICATION else { if (shell) sln.Print (" productType = \"com.apple.product-type.tool\";\n"); // OR shell application else sln.Print (" productType = \"com.apple.product-type.application\";\n"); // OR APPLICATION } sln.Print (" };\n"); sln.Print ("/* End PBXNativeTarget section */\n"); sln.Print ("\n"); sln.Print ("/* Begin PBXProject section */\n"); sln.PrintF(" %s /* Project object */ = {\n",guidProject); sln.Print (" isa = PBXProject;\n"); sln.Print (" attributes = {\n"); sln.Print (" ORGANIZATIONNAME = Farbrausch;\n"); sln.Print (" };\n"); sln.PrintF(" buildConfigurationList = %s /* Build configuration list for PBXProject */;\n",guidBuildProject); sln.Print (" compatibilityVersion = \"Xcode 3.2\";\n"); sln.Print (" developmentRegion = English;\n"); sln.Print (" hasScannedForEncodings = 0;\n"); sln.Print (" knownRegions = (\n"); sln.Print (" en,\n"); sln.Print (" );\n"); sln.PrintF(" mainGroup = %s;\n",guidmaingroup); sln.PrintF(" productRefGroup = %s /* Products */;\n",guidProducts); sln.Print (" projectDirPath = \"\";\n"); if(COOLLIBS) { sln.Print (" projectReferences = (\n"); for(auto dep : pro->Depends) { sln.Print (" {\n"); sln.PrintF(" ProductGroup = %s /* Productsref */;\n",guidProductRef); sln.PrintF(" ProjectRef = %08X000000BA%08X /* %s.xcodeproj */;\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); sln.Print (" },\n"); } sln.Print (" );\n"); } sln.Print (" projectRoot = \"\";\n"); sln.Print (" targets = (\n"); sln.PrintF(" %s /* target */,\n",guidTarget); sln.Print (" );\n"); sln.Print (" };\n"); sln.Print ("/* End PBXProject section */\n"); sln.Print ("\n"); sln.Print ("\n"); if(COOLLIBS) { sln.Print ("/* Begin PBXReferenceProxy section */\n"); for(auto dep : pro->Depends) { sln.PrintF(" %08X000000BC%08X /* lib%s.a */ = {\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); sln.Print (" isa = PBXReferenceProxy;\n"); sln.Print (" fileType = archive.ar;\n"); sln.PrintF(" path = lib%s.a;\n",dep->Project->Name); sln.PrintF(" remoteRef = %08X000000B1%08X /* PBXContainerItemProxy */;\n",pro->GuidHash,dep->Project->GuidHash); sln.Print (" sourceTree = BUILT_PRODUCTS_DIR;\n"); sln.Print (" };\n"); } sln.Print ("/* End PBXReferenceProxy section */\n"); sln.Print ("\n"); } sln.Print ("/* Begin PBXResourcesBuildPhase section */\n"); sln.PrintF(" %s /* Resources */ = {\n",guidPhaseResources); sln.Print (" isa = PBXResourcesBuildPhase;\n"); sln.Print (" buildActionMask = 2147483647;\n"); sln.Print (" files = (\n"); for(auto file : files) { if(file->ToolId==mTI_xib || file->ToolId==mTI_pak || file->ToolId==mTI_dat || file->ToolId==mTI_xml) sln.PrintF(" %s /* %s */,\n",file->XCodeRefGuid,file->Name); } sln.Print (" );\n"); sln.Print (" runOnlyForDeploymentPostprocessing = 0;\n"); sln.Print (" };\n"); sln.Print ("/* End PBXResourcesBuildPhase section */\n"); sln.Print ("\n"); sln.Print ("/* Begin PBXSourcesBuildPhase section */\n"); sln.PrintF(" %s /* Sources */ = {\n",guidPhaseSources); sln.Print (" isa = PBXSourcesBuildPhase;\n"); sln.Print (" buildActionMask = 2147483647;\n"); sln.Print (" files = (\n"); for(auto file : files) { switch(file->ToolId) { case mTI_cpp: case mTI_c: case mTI_m: case mTI_mm: case mTI_incbin: case mTI_packfile: case mTI_asc: case mTI_ops: // case mTI_xib: sln.PrintF(" %s /* %s */,\n",file->XCodeRefGuid,file->Name); break; default: break; } } sln.Print (" );\n"); sln.Print (" runOnlyForDeploymentPostprocessing = 0;\n"); sln.Print (" };\n"); sln.Print ("/* End PBXSourcesBuildPhase section */\n"); sln.Print ("\n"); if(COOLLIBS) { sln.Print ("/* Begin PBXTargetDependency section */\n"); for(auto dep : pro->Depends) { sln.PrintF(" %08X000000BD%08X /* lib%s.a */ = {\n",pro->GuidHash,dep->Project->GuidHash,dep->Project->Name); sln.Print (" isa = PBXTargetDependency;\n"); sln.PrintF(" name = %s;\n",dep->Project->Name); sln.PrintF(" targetProxy = %08X000000B3%08X /* PBXContainerItemProxy */;\n",pro->GuidHash,dep->Project->GuidHash); sln.Print (" };\n"); } sln.Print ("/* End PBXTargetDependency section */\n"); sln.Print ("\n"); } sln.Print ("/* Begin XCBuildConfiguration section */\n"); sInt n; n = 1; for(auto con : pro->Configs) { sPoolString PbxPro("PBXProject"); gr = con->VSGroups.Find([=](cVSGroup *g){return g->Name==PbxPro;}); if(gr) { sln.PrintF(" %08X000000D1%08X /* %s */ = {\n",pro->GuidHash,n,con->Name); sln.Print (" isa = XCBuildConfiguration;\n"); sln.Print (" buildSettings = {\n"); for(auto it : gr->VSItems) { Resolve(LargeBuffer,it->Value); sln.PrintF(" %Q = %Q;\n",it->Key,LargeBuffer); } sln.Print (" };\n"); sln.PrintF(" name = %s;\n",con->Name); sln.Print (" };\n"); } sPoolString PbxNav("PBXNativeTarget"); gr = con->VSGroups.Find([=](cVSGroup *g){return g->Name==PbxNav;}); if(gr) { sln.PrintF(" %08X000000D2%08X /* %s */ = {\n",pro->GuidHash,n,con->Name); sln.Print (" isa = XCBuildConfiguration;\n"); sln.Print (" buildSettings = {\n"); for(auto it : gr->VSItems) { Resolve(LargeBuffer,it->Value); sln.PrintF(" %Q = %Q;\n",it->Key,LargeBuffer); } sln.Print (" };\n"); sln.PrintF(" name = %s;\n",con->Name); sln.Print (" };\n"); } n++; } sln.Print ("/* End XCBuildConfiguration section */\n"); sln.Print ("\n"); sln.Print ("/* Begin XCConfigurationList section */\n"); sln.PrintF(" %s /* Build configuration list for PBXProject */ = {\n",guidBuildProject); sln.Print (" isa = XCConfigurationList;\n"); sln.Print (" buildConfigurations = (\n"); n = 1; for(auto con : pro->Configs) sln.PrintF(" %08X000000D1%08X /* %s */,\n",pro->GuidHash,n++,con->Name); sln.Print (" );\n"); sln.Print (" defaultConfigurationIsVisible = 0;\n"); sln.Print (" };\n"); sln.PrintF(" %s /* Build configuration list for PBXNativeTarget */ = {\n",guidBuildTarget); sln.Print (" isa = XCConfigurationList;\n"); sln.Print (" buildConfigurations = (\n"); n = 1; for(auto con : pro->Configs) sln.PrintF(" %08X000000D2%08X /* %s */,\n",pro->GuidHash,n++,con->Name); sln.Print (" );\n"); sln.Print (" defaultConfigurationIsVisible = 0;\n"); sln.Print (" };\n"); sln.Print ("/* End XCConfigurationList section */\n"); sln.Print ("\n"); sln.Print (" };\n"); sln.PrintF(" rootObject = %s /* Project object */;\n",guidProject); sln.Print ("}\n"); // done if(!Pretend) { sString<sMaxPath> buffer; buffer.PrintF("%s/%s_%s.xcodeproj",basepath,pro->Name,Platform->Name); sMakeDir(buffer); buffer.PrintF("%s/%s_%s.xcodeproj/project.pbxproj",basepath,pro->Name,Platform->Name); if(!sSaveTextAnsi(buffer,sln.Get(),0)) ok = 0; if (!pro->Library && !shell) { if(Platform->Name=="ios") { buffer.PrintF("%s/%s/ios.info.plist",basepath,pro->Name); if(!sCheckFile(buffer) || ForceInfo) sSaveTextUTF8(buffer,plist_txt); } else { buffer.PrintF("%s/%s/osx.info.plist",basepath,pro->Name); if(!sCheckFile(buffer) || ForceInfo) sSaveTextUTF8(buffer,osxplist_txt); } } } if(pro->Dump) { sDPrint("------------------------------------------------------------------------------\n"); sDPrint(sln.Get()); sDPrint("------------------------------------------------------------------------------\n"); } AdditionalFiles.DeleteAll(); return ok; }
Boolean AddressName::FromFormat(const String& value, const String& format) { *this = value; return Resolve(); }
AddressName::operator String () { Resolve(); return location; }
bool Path_Builder::Best_Lane_Use (int index, Dtime time, double len_factor, Dtime &ttime, Dtime &delay, int &cost, int &group) { int i, num, tt, cst, imp, lanes, type, grp, use_type [2], costs [2], best [2]; Dtime ttimes [2], delays [2]; double factor; Dir_Data *dir_ptr; Lane_Use_Data *use_ptr; Int_Map_Stat map_stat; Lane_Use_Period *period_ptr; Link_Dir_Data *use_index; dir_ptr = &exe->dir_array [index]; if (path_param.delay_flag) { ttimes [0] = exe->perf_period_array.Travel_Time (index, time, len_factor, forward_flag); if (dir_ptr->Use_Index () >= 0) { ttimes [1] = exe->perf_period_array.Travel_Time (dir_ptr->Use_Index (), time, len_factor, forward_flag); } } if (ttimes [0] < 0 && ttimes [1] <= 0) return (false); if (ttimes [0] == 0) ttimes [0] = dir_ptr->Time0 (); if (ttimes [1] == 0) ttimes [1] = dir_ptr->Time0 (); ttime = ttimes [0]; delay = 0; cost = group = 0; //---- find the time period ---- index = dir_ptr->First_Lane_Use (); if (index < 0) return (true); for (period_ptr = &exe->use_period_array [index]; ; period_ptr = &exe->use_period_array [++index]) { if (period_ptr->Start () <= time && time < period_ptr->End ()) break; if (period_ptr->Periods () == 0) return (true); } //---- set the lane group data ---- best [0] = best [1] = 0; delays [0] = delays [1] = 0; costs [0] = costs [1] = 0; use_type [0] = (period_ptr->Lanes (0) == 0) ? PROHIBIT : APPLY; use_type [1] = (period_ptr->Lanes (1) == 0) ? PROHIBIT : APPLY; type = path_param.traveler_type; num = period_ptr->Records (); index = period_ptr->Index (); for (i=0; i < num; i++, index++) { use_index = &exe->use_period_index [index]; use_ptr = &exe->lane_use_array [use_index->Link ()]; grp = use_index->Dir (); if (use_type [grp] == PROHIBIT) continue; lanes = use_ptr->High_Lane () - use_ptr->Low_Lane () + 1; if (lanes >= period_ptr->Lanes (grp)) { if (path_param.veh_type < 0 || use_ptr->Min_Veh_Type () < 0 || (use_ptr->Min_Veh_Type () <= path_param.veh_type && path_param.veh_type <= use_ptr->Max_Veh_Type ())) { if (type == 0 || use_ptr->Min_Traveler () < 0 || (use_ptr->Min_Traveler () <= type && type <= use_ptr->Max_Traveler ())) { if (Use_Permission (use_ptr->Use (), path_param.use)) { if (use_ptr->Type () == APPLY) { cst = use_ptr->Toll (); tt = use_ptr->Min_Delay (); if (use_ptr->Max_Delay () > use_ptr->Min_Delay ()) { map_stat = lane_use_delay.insert (Int_Map_Data (use_index->Link_Dir (), 0)); if (map_stat.second) { map_stat.first->second = DTOI ((use_ptr->Max_Delay () - use_ptr->Min_Delay ()) * path_param.random.Probability ()); } tt += map_stat.first->second; } imp = Resolve (tt * path_param.value_time + cst * path_param.value_cost); if (imp < best [grp] || best [grp] == 0) { delays [grp] = tt; costs [grp] = cst; best [grp] = imp; } use_type [grp] = APPLY; } else if (use_ptr->Type () == PROHIBIT) { use_type [grp] = PROHIBIT; } else if (use_ptr->Type () == REQUIRE) { use_type [1-grp] = PROHIBIT; } continue; } } } if (use_ptr->Type () == LIMIT) { use_type [grp] = PROHIBIT; } } } //---- select the best lane group ---- if (use_type [0] == PROHIBIT && use_type [1] == PROHIBIT) return (false); if (use_type [0] == APPLY && use_type [1] == APPLY) { best [0] += Resolve (ttimes [0] * path_param.value_time); best [1] += Resolve (ttimes [1] * path_param.value_time); if (random_flag) { factor = 1.0 + path_param.random_imped * (path_param.random.Probability () - 0.5) / 100.0; best [1] = DTOI (best [1] * factor); } if (best [1] > 0 && best [0] > 0) { group = (best [1] < best [0]) ? 1 : 0; } else { group = 0; } } else if (use_type [0] == APPLY) { group = 0; } else { group = 1; } delay = delays [group]; cost = costs [group]; ttime = ttimes [group]; return ((ttime > 0)); }
void Reschedule::Segment_Schedule (void) { int i, j, stop, stops, run, runs, link, links, route, count, num, lnk, dir; int shift, time1, time2, stop1, link_dir; bool first, select; num = link_equiv.Max_Group (); Driver_Data *driver_ptr; Line_Data *line_ptr; Stop_Data *stop_ptr; Integer_List *group; Schedule_File *new_schedule = (Schedule_File *) Network_Db_File (NEW_TRANSIT_SCHEDULE); Show_Message ("Writing %s -- Route", new_schedule->File_Type ()); Set_Progress (100); count = 0; link_factor -= 1.0; //---- read each route ---- for (line_ptr = line_data.First_Key (); line_ptr; line_ptr = line_data.Next_Key ()) { Show_Progress (); route = line_ptr->Route (); new_schedule->Route (route); stops = line_ptr->Stops (); runs = line_ptr->Runs (); //---- check the selection criteria ---- if ((route_flag && !select_routes.In_Range (route)) || !select_modes [line_ptr->Mode ()]) goto output; //---- scan for links in the link group ---- driver_ptr = driver_data [line_ptr->Driver ()]; if (driver_ptr == NULL) { Warning ("Route %d was Not Found in the Transit Driver File", route); continue; } links = driver_ptr->Links (); //---- find the first link ---- stop1 = stop = 1; stop_ptr = stop_data.Get (line_ptr->Stop (stop)); if (stop_ptr == NULL) { Warning ("Route %d Stop %d was Not Found", route, line_ptr->Stop (1)); continue; } for (i=1; i <= links; i++) { if (stop_ptr->Link_Dir () == driver_ptr->Link_Dir (i)) break; } if (i > links) { Warning ("Route %d Stops and Driver Links are Incompatible", route); continue; } first = false; shift = 0; for (; i <= links; i++) { link = driver_ptr->Link (i); dir = driver_ptr->Dir (i); link_dir = driver_ptr->Link_Dir (i); //---- process each link gorup ---- select = false; for (j=1; j <= num; j++) { group = link_equiv.Group_List (j); if (group == NULL) continue; for (lnk = group->First (); lnk; lnk = group->Next ()) { if (lnk < 0) { if (dir != 1 || link != abs (lnk)) continue; } else { if (dir != 0 || link != lnk) continue; } select = true; break; } if (select) break; } //---- processes the stops on the link while (stop_ptr->Link_Dir () == link_dir) { if (select) { if (!first) { first = true; stop1 = stop; } else { for (run = 1; run <= runs; run++) { time1 = line_ptr->Schedule (run, stop1); time2 = line_ptr->Schedule (run, stop); shift = (int) ((time2 - time1) * link_factor + 0.5); line_ptr->Penalty (run, stop, shift); } } } else { first = false; } //---- get the next stop ---- if (++stop > stops) break; stop_ptr = stop_data.Get (line_ptr->Stop (stop)); if (stop_ptr == NULL) { Warning ("Route %d Stop %d was Not Found", route, line_ptr->Stop (stop)); break; } } if (select && !first) { stop1 = stop; first = true; } } //---- save the schedule records ---- output: for (run=1; run <= runs; run++) { shift = 0; for (stop=1; stop <= stops; stop++) { new_schedule->Stop (line_ptr->Stop (stop)); time1 = line_ptr->Schedule (run, stop); time2 = line_ptr->Penalty (run, stop); if (time2 != 0) shift = time2; new_schedule->Time (Resolve (time1 + shift)); if (!new_schedule->Write ()) { Error ("Writing %s", new_schedule->File_Type ()); } count++; } } } End_Progress (); Write (2, "Number of %s Records = %d", new_schedule->File_Type (), count); }
uint8 *CScriptCache::GetScript(uint32 scriptName) { CSymbolTableEntry *p_entry=Resolve(scriptName); if (p_entry) { Dbg_MsgAssert(p_entry->mType==ESYMBOLTYPE_QSCRIPT,("Symbol %s is not a QScript",FindChecksumName(scriptName))); #ifndef __PLAT_NGC__ Dbg_MsgAssert(p_entry->mpScript,("NULL p_entry->mpScript")); #endif // __PLAT_NGC__ // Change the passed scriptName to be the actual scriptName so that when decompressed it gets registered in // the cache under the correct name. // Otherwise, if a SpawnScript Foo is done after Foo has been changed using the 'change' command, it // will spawn the old script again, since it will be in the cache under Foo. scriptName=p_entry->mNameChecksum; } CScriptCacheEntry *p_cache_entry=mp_cache_hash_table->GetItem(scriptName); if (p_cache_entry) { ++p_cache_entry->mUsage; #ifdef __NOPT_ASSERT__ if (p_cache_entry->mUsage==1) { ++m_num_used_scripts; if (m_num_used_scripts > m_max_used_scripts) { m_max_used_scripts=m_num_used_scripts; } } #endif remove_from_zero_usage_list(p_cache_entry); return p_cache_entry->mpDecompressedScript; } if (p_entry) { #ifdef __PLAT_NGC__ enum { COMPRESS_BUFFER_SIZE=20000, }; uint8 p_compress_buffer[COMPRESS_BUFFER_SIZE]; uint32 header[(SCRIPT_HEADER_SIZE/4)]; NsDMA::toMRAM( header, p_entry->mScriptOffset, SCRIPT_HEADER_SIZE ); uint32 uncompressed_size = header[1]; uint32 compressed_size = header[2]; NsDMA::toMRAM( p_compress_buffer, p_entry->mScriptOffset + SCRIPT_HEADER_SIZE, compressed_size ); #else // Note: The script contents checksum is at offset 0, but it is not needed. uint32 uncompressed_size = *(uint32*)(p_entry->mpScript+4); uint32 compressed_size = *(uint32*)(p_entry->mpScript+8); #endif // __PLAT_NGC__ remove_some_old_scripts(uncompressed_size,scriptName); CScriptCacheEntry *p_cache_entry=new CScriptCacheEntry; Mem::Manager::sHandle().PushContext(Mem::Manager::sHandle().ScriptHeap()); uint8 *p_new_script=(uint8*)Mem::Malloc(uncompressed_size); Mem::Manager::sHandle().PopContext(); if (uncompressed_size > compressed_size) { #ifdef __NOPT_ASSERT__ uint8 *p_end= #endif #ifdef __PLAT_NGC__ DecodeLZSS(p_compress_buffer,p_new_script,compressed_size); #else DecodeLZSS(p_entry->mpScript+SCRIPT_HEADER_SIZE,p_new_script,compressed_size); #endif // __PLAT_NGC__ Dbg_MsgAssert(p_end==p_new_script+uncompressed_size,("Eh? p_end is not right?")); } else { // The script is uncompressed so just copy it over. Saves, errr, 1K altogether, oh well. Dbg_MsgAssert(uncompressed_size == compressed_size,("Expected uncompressed_size==compressed_size")); #ifdef __PLAT_NGC__ uint8 *p_source=p_compress_buffer; #else uint8 *p_source=p_entry->mpScript+SCRIPT_HEADER_SIZE; #endif // __PLAT_NGC__ uint8 *p_dest=p_new_script; for (uint32 i=0; i<uncompressed_size; ++i) { *p_dest++=*p_source++; } } PreProcessScript(p_new_script); p_cache_entry->mpDecompressedScript=p_new_script; p_cache_entry->mUsage=1; p_cache_entry->mScriptNameChecksum=scriptName; #ifdef __NOPT_ASSERT__ ++m_num_used_scripts; if (m_num_used_scripts > m_max_used_scripts) { m_max_used_scripts=m_num_used_scripts; } #endif mp_cache_hash_table->PutItem(scriptName,p_cache_entry); #ifdef __NOPT_ASSERT__ ++mp_decompress_counts[m_current_decompress_count_index]; #endif return p_cache_entry->mpDecompressedScript; } return NULL; }