Changeset 610 for CMT/HEAD/source/cmt_symbol.cxx
- Timestamp:
- Apr 16, 2012, 12:17:30 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_symbol.cxx
r608 r610 2220 2220 } 2221 2221 2222 static bool find_path_entry (const cmt_string& paths, const cmt_string& value)2222 static bool find_path_entry (const CmtSystem::cmt_string_vector& items, const cmt_string& value) 2223 2223 { 2224 2224 static const cmt_string path_separator = CmtSystem::path_separator (); 2225 2225 static cmt_vmap <cmt_string, cmt_string> realpaths; 2226 2227 if (value.size () == 0) return true; 2226 2228 2227 2229 cmt_string rvalue; … … 2240 2242 } 2241 2243 2242 CmtSystem::cmt_string_vector items;2243 CmtSystem::split (paths, path_separator, items);2244 // CmtSystem::cmt_string_vector items; 2245 // CmtSystem::split (paths, path_separator, items); 2244 2246 2245 2247 bool found = false; … … 2248 2250 { 2249 2251 const cmt_string& item = items[i]; 2252 if (item.size () == 0) continue; 2250 2253 cmt_string ritem; 2251 2254 const cmt_string * pritem; … … 2272 2275 } 2273 2276 2277 static bool find_path_entry (const cmt_string& paths, const cmt_string& value) 2278 { 2279 static const cmt_string path_separator = CmtSystem::path_separator (); 2280 static cmt_vmap <cmt_string, cmt_string> realpaths; 2281 2282 cmt_string rvalue; 2283 const cmt_string * prvalue; 2284 2285 if (!(prvalue = realpaths.find (value))) 2286 { 2287 if (!CmtSystem::realpath_ (value, rvalue)) 2288 { 2289 rvalue = value; 2290 CmtSystem::compress_path (rvalue); 2291 } 2292 prvalue = &rvalue; 2293 realpaths.add (value, rvalue); 2294 // cerr << "realpaths.add: " << value << " , " << rvalue << endl; 2295 } 2296 2297 CmtSystem::cmt_string_vector items; 2298 CmtSystem::split (paths, path_separator, items); 2299 2300 bool found = false; 2301 2302 for (int i = 0; i < items.size (); i++) 2303 { 2304 const cmt_string& item = items[i]; 2305 cmt_string ritem; 2306 const cmt_string * pritem; 2307 2308 if (!(pritem = realpaths.find (item))) 2309 { 2310 if (!CmtSystem::realpath_ (item, ritem)) 2311 { 2312 ritem = item; 2313 CmtSystem::compress_path (ritem); 2314 } 2315 pritem = &ritem; 2316 realpaths.add (item, ritem); 2317 // cerr << "realpaths.add: " << item << " , " << ritem << endl; 2318 } 2319 if (*pritem == *prvalue) 2320 { 2321 found = true; 2322 break; 2323 } 2324 } 2325 2326 return (found); 2327 } 2328 2274 2329 //------------------------------------------------------------- 2275 2330 const cmt_string PathBuilder::build (const Symbol& symbol, … … 2282 2337 2283 2338 cmt_string temp; 2284 cmt_string previous_temp; 2339 CmtSystem::cmt_string_vector temp_vector; 2340 // cmt_string previous_temp; 2341 CmtSystem::cmt_string_vector new_value_vector; 2285 2342 cmt_string new_value; 2286 2343 static const cmt_string empty; … … 2301 2358 level++; 2302 2359 2303 temp = CmtSystem::getenv (symbol.name); 2360 CmtSystem::split (CmtSystem::getenv (symbol.name), path_separator, temp_vector); 2361 //temp = CmtSystem::getenv (symbol.name); 2304 2362 2305 2363 bool first_definition = true; … … 2337 2395 !symbol.value_is_reflexive (value.text)) 2338 2396 { 2397 Cmt::vector_to_string (temp_vector, path_separator, temp); 2339 2398 resolve_value (new_value, symbol.name, temp); 2340 temp = new_value; 2399 CmtSystem::split (new_value, path_separator, temp_vector); 2400 //temp = new_value; 2341 2401 } 2342 2402 … … 2346 2406 if (new_value != "") 2347 2407 { 2348 if (!find_path_entry (temp, new_value)) 2349 { 2350 if (temp != "") temp += path_separator; 2351 2352 temp += new_value; 2353 } 2408 CmtSystem::split (new_value, path_separator, new_value_vector); 2409 for (int i = 0; i < new_value_vector.size (); i++) 2410 if (!find_path_entry (temp_vector, new_value_vector[i])) 2411 //if (!find_path_entry (temp, new_value)) 2412 { 2413 temp_vector.push_back (new_value_vector[i]); 2414 /* 2415 if (temp != "") temp += path_separator; 2416 2417 temp += new_value; 2418 */ 2419 } 2354 2420 } 2355 2421 … … 2359 2425 if (new_value != "") 2360 2426 { 2361 if (!find_path_entry (temp, new_value)) 2362 { 2363 previous_temp = temp; 2364 temp = new_value; 2365 if (previous_temp != "") temp += path_separator; 2366 temp += previous_temp; 2367 } 2427 CmtSystem::split (new_value, path_separator, new_value_vector); 2428 int n (new_value_vector.size ()); 2429 temp_vector.resize (temp_vector.size () + n); 2430 for (int i = temp_vector.size () - 1; i > n - 1; i--) 2431 temp_vector [i] = temp_vector [i - n]; 2432 for (int i = 0; i < new_value_vector.size (); i++) 2433 if (!find_path_entry (temp_vector, new_value_vector[i])) 2434 //if (!find_path_entry (temp, new_value)) 2435 { 2436 temp_vector [i] = new_value_vector[i]; 2437 /* 2438 previous_temp = temp; 2439 temp = new_value; 2440 if (previous_temp != "") temp += path_separator; 2441 temp += previous_temp; 2442 */ 2443 } 2444 else 2445 temp_vector [i] = ""; 2368 2446 } 2369 2447 2370 2448 break; 2371 2449 case CommandPathRemove : … … 2373 2451 if (new_value != "") 2374 2452 { 2453 for (int j = 0; j < temp_vector.size (); ++j) 2454 { 2455 cmt_string& s = temp_vector[j]; 2456 2457 if (s.find (new_value) != cmt_string::npos) 2458 { 2459 s = ""; 2460 } 2461 } 2462 /* 2375 2463 CmtSystem::cmt_string_vector paths; 2376 2464 … … 2388 2476 2389 2477 Cmt::vector_to_string (paths, path_separator, temp); 2478 */ 2390 2479 } 2391 2480 … … 2397 2486 cmt_regexp e (new_value); 2398 2487 2488 for (int j = 0; j < temp_vector.size (); ++j) 2489 { 2490 cmt_string& s = temp_vector[j]; 2491 2492 if (Cmt::get_debug () && 2493 CmtSystem::getenv ("TESTPRR") != "") 2494 { 2495 cerr << "PRR> s=[" << s << "]"; 2496 } 2497 2498 if (e.match (s)) 2499 { 2500 s = ""; 2501 2502 if (Cmt::get_debug () && 2503 CmtSystem::getenv ("TESTPRR") != "") 2504 { 2505 cerr << " match "; 2506 } 2507 } 2508 else 2509 { 2510 if (Cmt::get_debug () && 2511 CmtSystem::getenv ("TESTPRR") != "") 2512 { 2513 cerr << " no match "; 2514 } 2515 } 2516 2517 if (Cmt::get_debug () && 2518 CmtSystem::getenv ("TESTPRR") != "") 2519 { 2520 cerr << endl; 2521 } 2522 } 2523 2524 /* 2399 2525 CmtSystem::cmt_string_vector paths; 2400 2526 … … 2434 2560 2435 2561 Cmt::vector_to_string (paths, path_separator, temp); 2562 */ 2436 2563 } 2437 2564 … … 2440 2567 2441 2568 } 2569 2570 Cmt::vector_to_string (temp_vector, path_separator, temp); 2442 2571 2443 2572 level--;
Note: See TracChangeset
for help on using the changeset viewer.