Analysis and restoration of ancient masonry structures: guidelines and examples