utils.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2007 Neal Norwitz
00004 # Portions Copyright 2007 Google Inc.
00005 #
00006 # Licensed under the Apache License, Version 2.0 (the "License");
00007 # you may not use this file except in compliance with the License.
00008 # You may obtain a copy of the License at
00009 #
00010 #      http://www.apache.org/licenses/LICENSE-2.0
00011 #
00012 # Unless required by applicable law or agreed to in writing, software
00013 # distributed under the License is distributed on an "AS IS" BASIS,
00014 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 # See the License for the specific language governing permissions and
00016 # limitations under the License.
00017 
00018 """Generic utilities for C++ parsing."""
00019 
00020 __author__ = 'nnorwitz@google.com (Neal Norwitz)'
00021 
00022 
00023 import sys
00024 
00025 
00026 # Set to True to see the start/end token indices.
00027 DEBUG = True
00028 
00029 
00030 def ReadFile(filename, print_error=True):
00031     """Returns the contents of a file."""
00032     try:
00033         fp = open(filename)
00034         try:
00035             return fp.read()
00036         finally:
00037             fp.close()
00038     except IOError:
00039         if print_error:
00040             print('Error reading %s: %s' % (filename, sys.exc_info()[1]))
00041         return None


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:57