~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

Viewing changes to Puma/src/cpp/PreFileIncluder.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 }
56
56
 
57
57
 
58
 
PreFileIncluder::~PreFileIncluder () 
59
 
 { 
60
 
    for (long i = 0; i < _includeDirs.length (); i++)
61
 
        delete[] _includeDirs[i];
62
 
 }
63
 
 
64
 
 
65
58
// Add a new path to include paths list.
66
 
void PreFileIncluder::addIncludePath (const char* path)
67
 
 {
68
 
    if (! path) return;
69
 
  
70
 
    char* tmp = new char[strlen(path) + 1];
71
 
    strcpy(tmp,path);
72
 
    
73
 
    _includeDirs.append (tmp);
74
 
 }
 
59
void PreFileIncluder::addIncludePath (const char* path) {
 
60
  if (path)
 
61
    _includeDirs.append (Filename (path));
 
62
}
75
63
 
76
64
 
77
65
// Include a file.
153
141
                
154
142
        // Search the path.
155
143
        for (i = _includeDirs.length () - 1; i >= 0; i--) 
156
 
            if (strcmp (path, _includeDirs[i]) == 0) 
 
144
            if (strcmp (path, _includeDirs[i].name ()) == 0) 
157
145
                break;
158
146
        
159
147
        // Calculate how many paths should skipped.
212
200
        file << token->text ();
213
201
    }
214
202
 
215
 
    file << std::ends;
216
203
    delete unit;
217
204
 
218
205
    // If file name is empty we have a syntax error.
284
271
        for (int i = _includeDirs.length () - _next; i >= 0; i--) 
285
272
        {
286
273
            // Build file name like `path/file'
287
 
            size     = strlen (file) + strlen (_includeDirs.lookup (i)) + 5;
 
274
            size     = strlen (file) +
 
275
                       strlen (_includeDirs.lookup (i).name ()) + 5;
288
276
            fullname = new char[size];
289
 
                sprintf (fullname, "%s/%s", _includeDirs.lookup (i), file);
 
277
            sprintf (fullname, "%s/%s", _includeDirs.lookup (i).name (),
 
278
              file);
290
279
            
291
280
            // Now try to include the file from current system 
292
281
            // include directory. If this is not the last directory