PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/solenv/bin/unxmap-to-macosx-explist.awk

https://bitbucket.org/markjenkins/libreoffice_ubuntu-debian-fixes
AWK | 54 lines | 16 code | 7 blank | 31 comment | 0 complexity | 8d450ed8fc67fb5eb56a0d841a820342 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0, MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause-No-Nuclear-License-2014
  1. #
  2. # This file is part of the LibreOffice project.
  3. #
  4. # This Source Code Form is subject to the terms of the Mozilla Public
  5. # License, v. 2.0. If a copy of the MPL was not distributed with this
  6. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. #
  8. # This file incorporates work covered by the following license notice:
  9. #
  10. # Licensed to the Apache Software Foundation (ASF) under one or more
  11. # contributor license agreements. See the NOTICE file distributed
  12. # with this work for additional information regarding copyright
  13. # ownership. The ASF licenses this file to you under the Apache
  14. # License, Version 2.0 (the "License"); you may not use this file
  15. # except in compliance with the License. You may obtain a copy of
  16. # the License at http://www.apache.org/licenses/LICENSE-2.0 .
  17. #
  18. # Generate an exported symbols list out of a map file (as use on Linux/Solaris) in order to
  19. # build shared libraries on Mac OS X
  20. #
  21. # The below code fails may fail with 'perverted' mapfiles (using a strange line layout etc.)
  22. # Skip 'SECTION_NAME {' lines
  23. /^[\t ]*.*[\t ]*\{/ { next }
  24. # Skip 'global:' or 'local:' lines
  25. /global:/ || /local:/ { next }
  26. # Skip '*;' lines
  27. /^[\t ]*\*;[\t ]*/ { next }
  28. # Skip section end '}?;' lines
  29. /^[\t ]*\}[\t ]*.*[;]*/ { next }
  30. # Skip comment or empty lines
  31. /^[\t ]*#.*/ || /^[\t ]*$/ || /^$/ { next }
  32. # Echo all lines containing symbol names and prefix them with '_'
  33. # because symbols on Mac OS X start always with '__'
  34. {
  35. # There may appear multiple symbols in one line
  36. # e.g. "sym1; sym2; # and finally a comment"
  37. # take this into account
  38. for (i = 1; i <= NF ; i++) {
  39. if ($i !~ /^[\t ]*#.*/) { # as long as the current field doesn't start with '#'
  40. gsub(/[\t ;]/, "", $i) # Remove leading spaces and trailing ';'
  41. printf("_%s\n",$i)
  42. }
  43. else { # ignore everything after a '#' (comment) sign
  44. break
  45. }
  46. }
  47. }