from os.path import dirname, join import json # Try to load JSON data from a file. If not found, use the argument as a tag name and retrieve the data from GitHub. def getJSON(tag='all'): f = tag tag = '/'+tag if f == 'all': f = 'releases' tag = '' try: d = json.loads(open(join(dirname(__file__), f+'.json'), 'r').read()) except: from urllib.request import urlopen d = json.loads(urlopen('https://api.github.com/repos/ghdl/ghdl/releases'+tag).read()) json.dump(d, open(f+'.json', 'w'), indent=4) return d # # Functions to print table with format `[ [], [], [], ... ]` to reStructuredText # # Print a row of data elements. def printTabRow(l, r): printTabItem(l, r, '| ') # Print a rule. Two characters in 'b' define the type of rule. Expected values are '+-', '+=' or '| '. def printTabRule(l, b): printTabItem(l, [b[1] for x in range(len(l))], b) # Print a full row, be it a rule or data. # Extend the width of each field to the size specified in 'l'. def printTabItem(l, a, b): for y, z in enumerate(a): print((b + z).ljust(l[y]+3, b[1]), end='') print(b[0]) # Get number of cols from number of elements in row 0. # Compute minimum number of characters required for each col. def getTabColLens(t): cl = [0 for _ in t[0]] for row in t: for y, z in enumerate(row): cl[y] = max(cl[y], len(z)) return cl # Print a table using the functions above. # The first row contains the headers. def printTab(t): clens = getTabColLens(t) printTabRule(clens, '+-') printTabRow(clens, t[0]) printTabRule(clens, '+=') for x in t[1:]: printTabRow(clens, x) printTabRule(clens, '+-') print() # # Print two versions of each shield. Onee for 'html' (`image::`) and one for 'latex' (`replace::`) # # Strip all non-alphanumeric characters when creating the labels def stripLabel(label): import re pattern = re.compile('[\W_]+') return pattern.sub('', label) def printShieldSrc(label, alt, img, target, latex=False): if latex: i = stripLabel(label) if label[-6:] == '/total': label = label[:-6] print('.. |l' + i + '| replace:: `' + label + '`_') print('.. _' + label + ': ' + target + '\n') else: print('.. |' + label + '| image:: '+ img + '\n', ' :target: ' + target + '\n', ' :height: 22\n', ' :alt: ' + alt + '\n') # # Display better OS and Backend names than those represented in the tarball name # def prettyOS(i): if i == 'fedora28': return 'Fedora 28' elif i == 'macosx': return 'Max OS X' elif i == 'mingw32': return 'Windows x86 (MinGW32)' elif i == 'mingw64': return 'Windows x86 (MinGW64)' elif i == 'stretch': return 'Debian 9 (Stretch)' elif i == 'gpl': return 'Debian 9 (Stretch) GPL' elif i == 'ubuntu14': return '14.04 LTS (Trusty Tahr)' return i def prettyBackend(i): if i == 'llvm': return 'LLVM' if i == 'llvm-3.8': return 'LLVM (3.8)' return i # # Get, extract and process JSON data to create the shields and table with the assets of a release # def createTagShields(data='latest'): if isinstance(data, str): data = getJSON(data) assets=[['OS', 'Backend', 'Size', 'Downloads']] tag = data['tag_name'] for x in data['assets']: name = x['name'] s = [] p = 'ghdl-gpl-'+tag[1:] if name[0:len(p)] == p: s = ['gpl', 'mcode'] p = 'ghdl-'+tag[1:] if name[0:len(p)] == p: s = name[len(p)+1:-4].split('-',1) if len(s) > 1: assets.append([ prettyOS(s[0]), prettyBackend(s[
/*
    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
                 2011,2012 Giovanni Di Sirio.

    This file is part of ChibiOS/RT.

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

    ChibiOS/RT 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _TESTRDY_H_
#define _TESTRDY_H_

extern ROMCONST struct testcase * ROMCONST patternthd[];

#endif /* _TESTRDY_H_ */