예제 #1
0
def load_map_and_media_as_atlas_objects(makefile):
    prefix, file = os.path.split(makefile)
    if prefix: prefix = prefix + os.sep
    sources = read_file(makefile)[0]

    all_objects = combine_files(sources.world_sources, prefix)
    #CHEAT: does only this special case ...
    if hasattr(sources, "world_sources_operations") and sources.world_sources_operations:
        file_as_operations(all_objects, sources.world_sources_operations[0][5:])
    
    all_media_info_dict = combine_files(sources.media_sources, prefix)

    return all_objects, all_media_info_dict

    base_definitions = read_file_as_dict("../../../protocols/atlas/spec/atlas.atlas")
    class_definitions = read_file_as_dict("../examples/meadow_class.atlas")
    objects = read_file_as_dict("../examples/meadow.atlas")
    all_objects = {}
    all_objects.update(base_definitions)
    all_objects.update(class_definitions)
    all_objects.update(objects)
    fill_attributes(list(all_objects.values()))
    
    media_info_dict = read_file_as_dict("../examples/meadow_media.atlas")
    all_media_info_dict = {}
    all_media_info_dict.update(base_definitions)
    all_media_info_dict.update(media_info_dict)
    fill_attributes(list(all_media_info_dict.values()))
    return all_objects, all_media_info_dict
예제 #2
0
def load_map_and_media_as_atlas_objects(makefile):
    prefix, file = os.path.split(makefile)
    if prefix: prefix = prefix + os.sep
    sources = read_file(makefile)[0]

    all_objects = combine_files(sources.world_sources, prefix)
    #CHEAT: does only this special case ...
    if hasattr(sources, "world_sources_operations") and sources.world_sources_operations:
        file_as_operations(all_objects, sources.world_sources_operations[0][5:])
    
    all_media_info_dict = combine_files(sources.media_sources, prefix)

    return all_objects, all_media_info_dict

    base_definitions = read_file_as_dict("../../../protocols/atlas/spec/atlas.atlas")
    class_definitions = read_file_as_dict("../examples/meadow_class.atlas")
    objects = read_file_as_dict("../examples/meadow.atlas")
    all_objects = {}
    all_objects.update(base_definitions)
    all_objects.update(class_definitions)
    all_objects.update(objects)
    fill_attributes(all_objects.values())
    
    media_info_dict = read_file_as_dict("../examples/meadow_media.atlas")
    all_media_info_dict = {}
    all_media_info_dict.update(base_definitions)
    all_media_info_dict.update(media_info_dict)
    fill_attributes(all_media_info_dict.values())
    return all_objects, all_media_info_dict
예제 #3
0
def combine_files(files, prefix=""):
    dict = {}
    for file in files:
        if file[:5]=="file:":
            file = file[5:]
        else:
            raise_(ValueError, "uri type not supported: " + file)
        print(file)
        dict.update(read_file_as_dict(prefix + file))
    fill_attributes(list(dict.values()))
    return dict
예제 #4
0
def combine_files(files, prefix=""):
    dict = {}
    for file in files:
        if file[:5]=="file:":
            file = file[5:]
        else:
            raise ValueError, "uri type not supported: " + file
        print file
        dict.update(read_file_as_dict(prefix + file))
    fill_attributes(dict.values())
    return dict
예제 #5
0
#Copyright (C) 2000 Aloril
#Copyright (C) 2002 by AIR-IX SUUNNITTELU/Ahiplan Oy

#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.

#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#Lesser General Public License for more details.

#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


import init
import operator
from atlas.analyse import fill_attributes
from atlas.transport.file import read_file, write_file

if __name__=="__main__":
    filelist = ["root", "entity", "operation", "type", "interface"]
    filelist = map(lambda file:file+".atlas", filelist)
    objects = reduce(operator.add, map(read_file, filelist))
    fill_attributes(objects)
    write_file(objects, "atlas.atlas")
예제 #6
0
#Copyright (C) 2000 Aloril
#Copyright (C) 2002 by AIR-IX SUUNNITTELU/Ahiplan Oy

#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.

#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#Lesser General Public License for more details.

#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


import init
import operator
from atlas.analyse import fill_attributes
from atlas.transport.file import read_file, write_file

if __name__=="__main__":
    filelist = ["root", "entity", "operation", "type"]
    filelist = map(lambda file:file+".atlas", filelist)
    objects = reduce(operator.add, map(read_file, filelist))
    fill_attributes(objects)
    write_file(objects, "atlas.atlas")