Changeset 8565a42 in mainline for contrib/arch


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

Location:
contrib/arch
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • contrib/arch/HelenOS.adl

    r3061bc1 r8565a42  
    22        /* SPARTAN kernel */
    33        inst kernel kernel;
    4        
     4
    55        /* Naming Service */
    66        inst ns ns;
    7        
     7
    88        /* Loader (clonable service) */
    99        inst loader loader;
    10        
     10
    1111        /* Device mapper */
    1212        inst devmap devmap;
    13        
     13
    1414        /* Block device */
    1515        inst bd bd;
    16        
     16
    1717        /* VFS server */
    1818        inst vfs vfs;
    19        
     19
    2020        /* Console */
    2121        inst console console;
    22        
     22
    2323        /* Kernel log */
    2424        inst kio kio;
    25        
     25
    2626        [/uspace/lib/libc/bind%ns]
    2727        [/uspace/lib/libc/bind%loader]
     
    3131        [/uspace/lib/libc/bind%console]
    3232        [/uspace/lib/libc/bind%kio]
    33        
     33
    3434        bind ns:kbd to console:kbd;
    3535        bind ns:fb to console:fb;
     
    3939        bind ns:devmap_client to devmap:devmap_client;
    4040        bind ns:loader to loader:loader;
    41        
     41
    4242        bind loader:ns to ns:ns;
    43        
     43
    4444        bind devmap:ns to ns:ns;
    4545        bind devmap:rd to bd:rd;
    4646        bind devmap:console to console:console;
    47        
     47
    4848        bind bd:ns to ns:ns;
    4949        bind bd:devmap_driver to devmap:devmap_driver;
    50        
     50
    5151        bind vfs:ns to ns:ns;
    5252        bind vfs:rd to bd:rd;
    5353        bind vfs:devmap_client to devmap:devmap_client;
    5454        bind vfs:device to console:console;
    55        
     55
    5656        bind console:ns to ns:ns;
    5757        bind console:devmap_driver to devmap:devmap_driver;
    5858        bind console:sys_console to kernel:sys_console;
    59        
     59
    6060        bind kio:ns to ns:ns;
    6161};
  • contrib/arch/hadlbppp.py

    r3061bc1 r8565a42  
    4141def usage(prname):
    4242        "Print usage syntax"
    43        
     43
    4444        print("%s <--bp|--ebp|--adl|--dot|--nop>+ <OUTPUT>" % prname)
    4545        print()
     
    5353def tabs(cnt):
    5454        "Return given number of tabs"
    55        
     55
    5656        return ("\t" * cnt)
    5757
    5858def cond_append(tokens, token, trim):
    5959        "Conditionally append token to tokens with trim"
    60        
     60
    6161        if (trim):
    6262                token = token.strip(" \t")
    63        
     63
    6464        if (token != ""):
    6565                tokens.append(token)
    66        
     66
    6767        return tokens
    6868
    6969def split_tokens(string, delimiters, trim = False, separate = False):
    7070        "Split string to tokens by delimiters, keep the delimiters"
    71        
     71
    7272        tokens = []
    7373        last = 0
    7474        i = 0
    75        
     75
    7676        while (i < len(string)):
    7777                for delim in delimiters:
    7878                        if (len(delim) > 0):
    79                                
     79
    8080                                if (string[i:(i + len(delim))] == delim):
    8181                                        if (separate):
     
    8686                                                tokens = cond_append(tokens, string[last:i], trim)
    8787                                                last = i
    88                                        
     88
    8989                                        i += len(delim) - 1
    9090                                        break
    91                
     91
    9292                i += 1
    93        
     93
    9494        tokens = cond_append(tokens, string[last:len(string)], trim)
    95        
     95
    9696        return tokens
    9797
    9898def identifier(token):
    9999        "Check whether the token is an identifier"
    100        
     100
    101101        if (len(token) == 0):
    102102                return False
    103        
     103
    104104        for i, char in enumerate(token):
    105105                if (i == 0):
     
    109109                        if ((not char.isalnum()) and (char != "_")):
    110110                                return False
    111        
     111
    112112        return True
    113113
    114114def descriptor(token):
    115115        "Check whether the token is an interface descriptor"
    116        
     116
    117117        parts = token.split(":")
    118118        if (len(parts) != 2):
    119119                return False
    120        
     120
    121121        return (identifier(parts[0]) and identifier(parts[1]))
    122122
    123123def word(token):
    124124        "Check whether the token is a word"
    125        
     125
    126126        if (len(token) == 0):
    127127                return False
    128        
     128
    129129        for i, char in enumerate(token):
    130130                if ((not char.isalnum()) and (char != "_") and (char != ".")):
    131131                        return False
    132        
     132
    133133        return True
    134134
    135135def tentative_bp(name, tokens):
    136136        "Preprocess tentative statements in Behavior Protocol"
    137        
     137
    138138        result = []
    139139        i = 0
    140        
     140
    141141        while (i < len(tokens)):
    142142                if (tokens[i] == "tentative"):
     
    145145                                start = i
    146146                                level = 1
    147                                
     147
    148148                                while ((i < len(tokens)) and (level > 0)):
    149149                                        if (tokens[i] == "{"):
     
    151151                                        elif (tokens[i] == "}"):
    152152                                                level -= 1
    153                                        
     153
    154154                                        i += 1
    155                                
     155
    156156                                if (level == 0):
    157157                                        result.append("(")
     
    168168                else:
    169169                        result.append(tokens[i])
    170                
     170
    171171                i += 1
    172        
     172
    173173        return result
    174174
    175175def alternative_bp(name, tokens):
    176176        "Preprocess alternative statements in Behavior Protocol"
    177        
     177
    178178        result = []
    179179        i = 0
    180        
     180
    181181        while (i < len(tokens)):
    182182                if (tokens[i] == "alternative"):
     
    184184                                i += 2
    185185                                reps = []
    186                                
     186
    187187                                while ((i < len(tokens)) and (tokens[i] != ")")):
    188188                                        reps.append(tokens[i])
     
    191191                                        else:
    192192                                                i += 1
    193                                
     193
    194194                                if (len(reps) >= 2):
    195195                                        if ((i + 1 < len(tokens)) and (tokens[i + 1] == "{")):
    196196                                                i += 2
    197                                                
     197
    198198                                                start = i
    199199                                                level = 1
    200                                                
     200
    201201                                                while ((i < len(tokens)) and (level > 0)):
    202202                                                        if (tokens[i] == "{"):
     
    204204                                                        elif (tokens[i] == "}"):
    205205                                                                level -= 1
    206                                                        
     206
    207207                                                        i += 1
    208                                                
     208
    209209                                                if (level == 0):
    210210                                                        first = True
    211                                                        
     211
    212212                                                        for rep in reps[1:]:
    213213                                                                retokens = []
     
    218218                                                                        else:
    219219                                                                                retokens.append(token)
    220                                                                
     220
    221221                                                                if (first):
    222222                                                                        first = False
    223223                                                                else:
    224224                                                                        result.append("+")
    225                                                                
     225
    226226                                                                result.append("(")
    227227                                                                result.extend(alternative_bp(name, retokens))
    228228                                                                result.append(")")
    229                                                        
     229
    230230                                                        if (i < len(tokens)):
    231231                                                                result.append(tokens[i])
     
    240240                else:
    241241                        result.append(tokens[i])
    242                
     242
    243243                i += 1
    244        
     244
    245245        return result
    246246
    247247def split_bp(protocol):
    248248        "Convert Behavior Protocol to tokens"
    249        
     249
    250250        return split_tokens(protocol, ["\n", " ", "\t", "(", ")", "{", "}", "*", ";", "+", "||", "|", "!", "?"], True, True)
    251251
    252252def extend_bp(name, tokens, iface):
    253253        "Convert interface Behavior Protocol to generic protocol"
    254        
     254
    255255        result = []
    256256        i = 0
    257        
     257
    258258        while (i < len(tokens)):
    259259                result.append(tokens[i])
    260                
     260
    261261                if (tokens[i] == "?"):
    262262                        if (i + 1 < len(tokens)):
    263263                                i += 1
    264264                                parts = tokens[i].split(".")
    265                                
     265
    266266                                if (len(parts) == 1):
    267267                                        result.append("%s.%s" % (iface, tokens[i]))
     
    270270                        else:
    271271                                print("%s: Unexpected end of protocol" % name)
    272                
     272
    273273                i += 1
    274        
     274
    275275        return result
    276276
    277277def merge_bp(initialization, finalization, protocols):
    278278        "Merge several Behavior Protocols"
    279        
     279
    280280        indep = []
    281        
     281
    282282        if (len(protocols) > 1):
    283283                first = True
    284                
     284
    285285                for protocol in protocols:
    286286                        if (first):
     
    288288                        else:
    289289                                indep.append("|")
    290                        
     290
    291291                        indep.append("(")
    292292                        indep.extend(protocol)
     
    294294        elif (len(protocols) == 1):
    295295                indep = protocols[0]
    296        
     296
    297297        inited = []
    298        
     298
    299299        if (initialization != None):
    300300                if (len(indep) > 0):
     
    310310        else:
    311311                inited = indep
    312        
     312
    313313        finited = []
    314        
     314
    315315        if (finalization != None):
    316316                if (len(inited) > 0):
     
    326326        else:
    327327                finited = inited
    328        
     328
    329329        return finited
    330330
    331331def parse_bp(name, tokens, base_indent):
    332332        "Parse Behavior Protocol"
    333        
     333
    334334        tokens = tentative_bp(name, tokens)
    335335        tokens = alternative_bp(name, tokens)
    336        
     336
    337337        indent = base_indent
    338338        output = ""
    339        
     339
    340340        for token in tokens:
    341341                if (token == "\n"):
    342342                        continue
    343                
     343
    344344                if ((token == ";") or (token == "+") or (token == "||") or (token == "|")):
    345345                        output += " %s" % token
     
    350350                        if (indent < base_indent):
    351351                                print("%s: Too many parentheses" % name)
    352                        
     352
    353353                        indent -= 1
    354354                        output += "\n%s%s" % (tabs(indent), token)
     
    359359                        if (indent < base_indent):
    360360                                print("%s: Too many parentheses" % name)
    361                        
     361
    362362                        indent -= 1
    363363                        output += "\n%s%s" % (tabs(indent), token)
     
    368368                else:
    369369                        output += "%s" % token
    370        
     370
    371371        if (indent > base_indent):
    372372                print("%s: Missing parentheses" % name)
    373        
     373
    374374        output = output.strip()
    375375        if (output == ""):
    376376                return "NULL"
    377        
     377
    378378        return output
    379379
    380380def parse_ebp(component, name, tokens, base_indent):
    381381        "Parse Behavior Protocol and generate Extended Behavior Protocol output"
    382        
     382
    383383        return "component %s {\n\tbehavior {\n\t\t%s\n\t}\n}" % (component, parse_bp(name, tokens, base_indent + 2))
    384384
    385385def get_iface(name):
    386386        "Get interface by name"
    387        
     387
    388388        global iface_properties
    389        
     389
    390390        if (name in iface_properties):
    391391                return iface_properties[name]
    392        
     392
    393393        return None
    394394
    395395def inherited_protocols(iface):
    396396        "Get protocols inherited by an interface"
    397        
     397
    398398        result = []
    399        
     399
    400400        if ('extends' in iface):
    401401                supiface = get_iface(iface['extends'])
     
    406406                else:
    407407                        print("%s: Extends unknown interface '%s'" % (iface['name'], iface['extends']))
    408        
     408
    409409        return result
    410410
    411411def dump_frame(directed_binds, frame, outdir, var, archf):
    412412        "Dump Behavior Protocol of a given frame"
    413        
     413
    414414        global opt_bp
    415415        global opt_ebp
    416        
     416
    417417        if (opt_ebp):
    418418                fname = "%s.ebp" % frame['name']
    419419        else:
    420420                fname = "%s.bp" % frame['name']
    421        
     421
    422422        if (archf != None):
    423423                archf.write("instantiate %s from \"%s\"\n" % (var, fname))
    424        
     424
    425425        outname = os.path.join(outdir, fname)
    426        
     426
    427427        protocols = []
    428428        if ('protocol' in frame):
    429429                protocols.append(frame['protocol'])
    430        
     430
    431431        if ('initialization' in frame):
    432432                initialization = frame['initialization']
    433433        else:
    434434                initialization = None
    435        
     435
    436436        if ('finalization' in frame):
    437437                finalization = frame['finalization']
    438438        else:
    439439                finalization = None
    440        
     440
    441441        if ('provides' in frame):
    442442                for provides in frame['provides']:
     
    448448                                else:
    449449                                        cnt = 1
    450                                
     450
    451451                                if ('protocol' in iface):
    452452                                        proto = extend_bp(outname, iface['protocol'], iface['name'])
    453453                                        for _ in range(0, cnt):
    454454                                                protocols.append(proto)
    455                                
     455
    456456                                for protocol in inherited_protocols(iface):
    457457                                        proto = extend_bp(outname, protocol, iface['name'])
     
    460460                        else:
    461461                                print("%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface']))
    462        
     462
    463463        if (opt_bp):
    464464                outf = open(outname, "w")
    465465                outf.write(parse_bp(outname, merge_bp(initialization, finalization, protocols), 0))
    466466                outf.close()
    467        
     467
    468468        if (opt_ebp):
    469469                outf = open(outname, "w")
     
    473473def get_system_arch():
    474474        "Get system architecture"
    475        
     475
    476476        global arch_properties
    477        
     477
    478478        for arch, properties in arch_properties.items():
    479479                if ('system' in properties):
    480480                        return properties
    481        
     481
    482482        return None
    483483
    484484def get_arch(name):
    485485        "Get architecture by name"
    486        
     486
    487487        global arch_properties
    488        
     488
    489489        if (name in arch_properties):
    490490                return arch_properties[name]
    491        
     491
    492492        return None
    493493
    494494def get_frame(name):
    495495        "Get frame by name"
    496        
     496
    497497        global frame_properties
    498        
     498
    499499        if (name in frame_properties):
    500500                return frame_properties[name]
    501        
     501
    502502        return None
    503503
    504504def create_null_bp(fname, outdir, archf):
    505505        "Create null frame protocol"
    506        
     506
    507507        global opt_bp
    508508        global opt_ebp
    509        
     509
    510510        if (archf != None):
    511511                archf.write("frame \"%s\"\n" % fname)
    512        
     512
    513513        outname = os.path.join(outdir, fname)
    514        
     514
    515515        if (opt_bp):
    516516                outf = open(outname, "w")
    517517                outf.write("NULL")
    518518                outf.close()
    519        
     519
    520520        if (opt_ebp):
    521521                outf = open(outname, "w")
     
    525525def flatten_binds(binds, delegates, subsumes):
    526526        "Remove bindings which are replaced by delegation or subsumption"
    527        
     527
    528528        result = []
    529529        stable = True
    530        
     530
    531531        for bind in binds:
    532532                keep = True
    533                
     533
    534534                for delegate in delegates:
    535535                        if (bind['to'] == delegate['to']):
    536536                                keep = False
    537537                                result.append({'from': bind['from'], 'to': delegate['rep']})
    538                
     538
    539539                for subsume in subsumes:
    540540                        if (bind['from'] == subsume['from']):
    541541                                keep = False
    542542                                result.append({'from': subsume['rep'], 'to': bind['to']})
    543                
     543
    544544                if (keep):
    545545                        result.append(bind)
    546546                else:
    547547                        stable = False
    548        
     548
    549549        if (stable):
    550550                return result
     
    554554def direct_binds(binds):
    555555        "Convert bindings matrix to set of sources by destination"
    556        
     556
    557557        result = {}
    558        
     558
    559559        for bind in binds:
    560560                if (not bind['to'] in result):
    561561                        result[bind['to']] = set()
    562                
     562
    563563                result[bind['to']].add(bind['from'])
    564        
     564
    565565        return result
    566566
    567567def merge_arch(prefix, arch, outdir):
    568568        "Merge subarchitecture into architecture"
    569        
     569
    570570        insts = []
    571571        binds = []
    572572        delegates = []
    573573        subsumes = []
    574        
     574
    575575        if ('inst' in arch):
    576576                for inst in arch['inst']:
     
    588588                                else:
    589589                                        print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
    590        
     590
    591591        if ('bind' in arch):
    592592                for bind in arch['bind']:
    593593                        binds.append({'from': "%s_%s.%s" % (prefix, bind['from'][0], bind['from'][1]), 'to': "%s_%s.%s" % (prefix, bind['to'][0], bind['to'][1])})
    594        
     594
    595595        if ('delegate' in arch):
    596596                for delegate in arch['delegate']:
    597597                        delegates.append({'to': "%s.%s" % (prefix, delegate['from']), 'rep': "%s_%s.%s" % (prefix, delegate['to'][0], delegate['to'][1])})
    598        
     598
    599599        if ('subsume' in arch):
    600600                for subsume in arch['subsume']:
    601601                        subsumes.append({'from': "%s.%s" % (prefix, subsume['to']), 'rep': "%s_%s.%s" % (prefix, subsume['from'][0], subsume['from'][1])})
    602        
     602
    603603        return (insts, binds, delegates, subsumes)
    604604
    605605def dump_archbp(outdir):
    606606        "Dump system architecture Behavior Protocol"
    607        
     607
    608608        global opt_bp
    609609        global opt_ebp
    610        
     610
    611611        arch = get_system_arch()
    612        
     612
    613613        if (arch is None):
    614614                print("Unable to find system architecture")
    615615                return
    616        
     616
    617617        insts = []
    618618        binds = []
    619619        delegates = []
    620620        subsumes = []
    621        
     621
    622622        if ('inst' in arch):
    623623                for inst in arch['inst']:
     
    635635                                else:
    636636                                        print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
    637        
     637
    638638        if ('bind' in arch):
    639639                for bind in arch['bind']:
    640640                        binds.append({'from': "%s.%s" % (bind['from'][0], bind['from'][1]), 'to': "%s.%s" % (bind['to'][0], bind['to'][1])})
    641        
     641
    642642        if ('delegate' in arch):
    643643                for delegate in arch['delegate']:
    644644                        print("Unable to delegate interface in system architecture")
    645645                        break
    646        
     646
    647647        if ('subsume' in arch):
    648648                for subsume in arch['subsume']:
    649649                        print("Unable to subsume interface in system architecture")
    650650                        break
    651        
     651
    652652        directed_binds = direct_binds(flatten_binds(binds, delegates, subsumes))
    653        
     653
    654654        outname = os.path.join(outdir, "%s.archbp" % arch['name'])
    655655        if ((opt_bp) or (opt_ebp)):
     
    657657        else:
    658658                outf = None
    659        
     659
    660660        create_null_bp("null.bp", outdir, outf)
    661        
     661
    662662        for inst in insts:
    663663                dump_frame(directed_binds, inst['frame'], outdir, inst['var'], outf)
    664        
     664
    665665        for dst, src in directed_binds.items():
    666666                if (outf != None):
    667667                        outf.write("bind %s to %s\n" % (", ".join(src), dst))
    668        
     668
    669669        if (outf != None):
    670670                outf.close()
     
    672672def preproc_adl(raw, inarg):
    673673        "Preprocess %% statements in ADL"
    674        
     674
    675675        return raw.replace("%%", inarg)
    676676
    677677def parse_adl(base, root, inname, nested, indent):
    678678        "Parse Architecture Description Language"
    679        
     679
    680680        global output
    681681        global context
     
    686686        global initialization
    687687        global finalization
    688        
     688
    689689        global iface_properties
    690690        global frame_properties
    691691        global arch_properties
    692        
     692
    693693        global arg0
    694        
     694
    695695        if (nested):
    696696                parts = inname.split("%")
    697                
     697
    698698                if (len(parts) > 1):
    699699                        inarg = parts[1]
    700700                else:
    701701                        inarg = "%%"
    702                
     702
    703703                if (parts[0][0:1] == "/"):
    704704                        path = os.path.join(base, ".%s" % parts[0])
     
    707707                        path = os.path.join(root, parts[0])
    708708                        nested_root = root
    709                
     709
    710710                if (not os.path.isfile(path)):
    711711                        print("%s: Unable to include file %s" % (inname, path))
     
    715715                path = inname
    716716                nested_root = root
    717        
     717
    718718        inf = open(path, "r")
    719        
     719
    720720        raw = preproc_adl(inf.read(), inarg)
    721721        tokens = split_tokens(raw, ["\n", " ", "\t", "(", ")", "{", "}", "[", "]", "/*", "*/", "#", ";"], True, True)
    722        
     722
    723723        for token in tokens:
    724                
     724
    725725                # Includes
    726                
     726
    727727                if (INC in context):
    728728                        context.remove(INC)
     
    730730                        context.add(POST_INC)
    731731                        continue
    732                
     732
    733733                if (POST_INC in context):
    734734                        if (token != "]"):
    735735                                print("%s: Expected ]" % inname)
    736                        
     736
    737737                        context.remove(POST_INC)
    738738                        continue
    739                
     739
    740740                # Comments and newlines
    741                
     741
    742742                if (BLOCK_COMMENT in context):
    743743                        if (token == "*/"):
    744744                                context.remove(BLOCK_COMMENT)
    745                        
     745
    746746                        continue
    747                
     747
    748748                if (LINE_COMMENT in context):
    749749                        if (token == "\n"):
    750750                                context.remove(LINE_COMMENT)
    751                        
     751
    752752                        continue
    753                
     753
    754754                # Any context
    755                
     755
    756756                if (token == "/*"):
    757757                        context.add(BLOCK_COMMENT)
    758758                        continue
    759                
     759
    760760                if (token == "#"):
    761761                        context.add(LINE_COMMENT)
    762762                        continue
    763                
     763
    764764                if (token == "["):
    765765                        context.add(INC)
    766766                        continue
    767                
     767
    768768                if (token == "\n"):
    769769                        continue
    770                
     770
    771771                # "frame"
    772                
     772
    773773                if (FRAME in context):
    774774                        if (NULL in context):
     
    777777                                else:
    778778                                        output += "%s\n" % token
    779                                
     779
    780780                                context.remove(NULL)
    781781                                context.remove(FRAME)
    782782                                frame = None
    783783                                continue
    784                        
     784
    785785                        if (BODY in context):
    786786                                if (FINALIZATION in context):
     
    789789                                        elif (token == "}"):
    790790                                                indent -= 1
    791                                        
     791
    792792                                        if (((token[-1] == ":") and (indent == 0)) or (indent == -1)):
    793793                                                bp = split_bp(finalization)
    794794                                                finalization = None
    795                                                
     795
    796796                                                if (not frame in frame_properties):
    797797                                                        frame_properties[frame] = {}
    798                                                
     798
    799799                                                if ('finalization' in frame_properties[frame]):
    800800                                                        print("%s: Finalization protocol for frame '%s' already defined" % (inname, frame))
    801801                                                else:
    802802                                                        frame_properties[frame]['finalization'] = bp
    803                                                
     803
    804804                                                output += "\n%s" % tabs(2)
    805805                                                output += parse_bp(inname, bp, 2)
    806                                                
     806
    807807                                                context.remove(FINALIZATION)
    808808                                                if (indent == -1):
     
    817817                                                finalization += token
    818818                                                continue
    819                                
     819
    820820                                if (INITIALIZATION in context):
    821821                                        if (token == "{"):
     
    823823                                        elif (token == "}"):
    824824                                                indent -= 1
    825                                        
     825
    826826                                        if (((token[-1] == ":") and (indent == 0)) or (indent == -1)):
    827827                                                bp = split_bp(initialization)
    828828                                                initialization = None
    829                                                
     829
    830830                                                if (not frame in frame_properties):
    831831                                                        frame_properties[frame] = {}
    832                                                
     832
    833833                                                if ('initialization' in frame_properties[frame]):
    834834                                                        print("%s: Initialization protocol for frame '%s' already defined" % (inname, frame))
    835835                                                else:
    836836                                                        frame_properties[frame]['initialization'] = bp
    837                                                
     837
    838838                                                output += "\n%s" % tabs(2)
    839839                                                output += parse_bp(inname, bp, 2)
    840                                                
     840
    841841                                                context.remove(INITIALIZATION)
    842842                                                if (indent == -1):
     
    851851                                                initialization += token
    852852                                                continue
    853                                
     853
    854854                                if (PROTOCOL in context):
    855855                                        if (token == "{"):
     
    857857                                        elif (token == "}"):
    858858                                                indent -= 1
    859                                        
     859
    860860                                        if (((token[-1] == ":") and (indent == 0)) or (indent == -1)):
    861861                                                bp = split_bp(protocol)
    862862                                                protocol = None
    863                                                
     863
    864864                                                if (not frame in frame_properties):
    865865                                                        frame_properties[frame] = {}
    866                                                
     866
    867867                                                if ('protocol' in frame_properties[frame]):
    868868                                                        print("%s: Protocol for frame '%s' already defined" % (inname, frame))
    869869                                                else:
    870870                                                        frame_properties[frame]['protocol'] = bp
    871                                                
     871
    872872                                                output += "\n%s" % tabs(2)
    873873                                                output += parse_bp(inname, bp, 2)
    874                                                
     874
    875875                                                context.remove(PROTOCOL)
    876876                                                if (indent == -1):
     
    885885                                                protocol += token
    886886                                                continue
    887                                
     887
    888888                                if (REQUIRES in context):
    889889                                        if (FIN in context):
     
    892892                                                else:
    893893                                                        output += "%s" % token
    894                                                
     894
    895895                                                context.remove(FIN)
    896896                                                continue
    897                                        
     897
    898898                                        if (VAR in context):
    899899                                                if (not identifier(token)):
     
    902902                                                        if (not frame in frame_properties):
    903903                                                                frame_properties[frame] = {}
    904                                                        
     904
    905905                                                        if (not 'requires' in frame_properties[frame]):
    906906                                                                frame_properties[frame]['requires'] = []
    907                                                        
     907
    908908                                                        frame_properties[frame]['requires'].append({'iface': arg0, 'var': token})
    909909                                                        arg0 = None
    910                                                        
     910
    911911                                                        output += "%s" % token
    912                                                
     912
    913913                                                context.remove(VAR)
    914914                                                context.add(FIN)
    915915                                                continue
    916                                        
     916
    917917                                        if ((token == "}") or (token[-1] == ":")):
    918918                                                context.remove(REQUIRES)
     
    923923                                                        arg0 = token
    924924                                                        output += "\n%s%s " % (tabs(indent), token)
    925                                                
     925
    926926                                                context.add(VAR)
    927927                                                continue
    928                                
     928
    929929                                if (PROVIDES in context):
    930930                                        if (FIN in context):
     
    933933                                                else:
    934934                                                        output += "%s" % token
    935                                                
     935
    936936                                                context.remove(FIN)
    937937                                                continue
    938                                        
     938
    939939                                        if (VAR in context):
    940940                                                if (not identifier(token)):
     
    943943                                                        if (not frame in frame_properties):
    944944                                                                frame_properties[frame] = {}
    945                                                        
     945
    946946                                                        if (not 'provides' in frame_properties[frame]):
    947947                                                                frame_properties[frame]['provides'] = []
    948                                                        
     948
    949949                                                        frame_properties[frame]['provides'].append({'iface': arg0, 'var': token})
    950950                                                        arg0 = None
    951                                                        
     951
    952952                                                        output += "%s" % token
    953                                                
     953
    954954                                                context.remove(VAR)
    955955                                                context.add(FIN)
    956956                                                continue
    957                                        
     957
    958958                                        if ((token == "}") or (token[-1] == ":")):
    959959                                                context.remove(PROVIDES)
     
    964964                                                        arg0 = token
    965965                                                        output += "\n%s%s " % (tabs(indent), token)
    966                                                
     966
    967967                                                context.add(VAR)
    968968                                                continue
    969                                
     969
    970970                                if (token == "}"):
    971971                                        if (indent != 2):
     
    974974                                                indent = 0
    975975                                                output += "\n%s" % token
    976                                        
     976
    977977                                        context.remove(BODY)
    978978                                        context.add(NULL)
    979979                                        continue
    980                                
     980
    981981                                if (token == "provides:"):
    982982                                        output += "\n%s%s" % (tabs(indent - 1), token)
    983983                                        context.add(PROVIDES)
    984984                                        continue
    985                                
     985
    986986                                if (token == "requires:"):
    987987                                        output += "\n%s%s" % (tabs(indent - 1), token)
    988988                                        context.add(REQUIRES)
    989989                                        continue
    990                                
     990
    991991                                if (token == "initialization:"):
    992992                                        output += "\n%s%s" % (tabs(indent - 1), token)
     
    995995                                        initialization = ""
    996996                                        continue
    997                                
     997
    998998                                if (token == "finalization:"):
    999999                                        output += "\n%s%s" % (tabs(indent - 1), token)
     
    10021002                                        finalization = ""
    10031003                                        continue
    1004                                
     1004
    10051005                                if (token == "protocol:"):
    10061006                                        output += "\n%s%s" % (tabs(indent - 1), token)
     
    10091009                                        protocol = ""
    10101010                                        continue
    1011                                
     1011
    10121012                                print("%s: Unknown token '%s' in frame '%s'" % (inname, token, frame))
    10131013                                continue
    1014                        
     1014
    10151015                        if (HEAD in context):
    10161016                                if (token == "{"):
     
    10201020                                        context.add(BODY)
    10211021                                        continue
    1022                                
     1022
    10231023                                if (token == ";"):
    10241024                                        output += "%s\n" % token
     
    10261026                                        context.remove(FRAME)
    10271027                                        continue
    1028                                
     1028
    10291029                                print("%s: Unknown token '%s' in frame head '%s'" % (inname, token, frame))
    1030                                
     1030
    10311031                                continue
    1032                        
     1032
    10331033                        if (not identifier(token)):
    10341034                                print("%s: Expected frame name" % inname)
     
    10361036                                frame = token
    10371037                                output += "%s " % token
    1038                                
     1038
    10391039                                if (not frame in frame_properties):
    10401040                                        frame_properties[frame] = {}
    1041                                
     1041
    10421042                                frame_properties[frame]['name'] = frame
    1043                        
     1043
    10441044                        context.add(HEAD)
    10451045                        continue
    1046                
     1046
    10471047                # "interface"
    1048                
     1048
    10491049                if (IFACE in context):
    10501050                        if (NULL in context):
     
    10531053                                else:
    10541054                                        output += "%s\n" % token
    1055                                
     1055
    10561056                                context.remove(NULL)
    10571057                                context.remove(IFACE)
    10581058                                interface = None
    10591059                                continue
    1060                        
     1060
    10611061                        if (BODY in context):
    10621062                                if (PROTOCOL in context):
     
    10651065                                        elif (token == "}"):
    10661066                                                indent -= 1
    1067                                        
     1067
    10681068                                        if (indent == -1):
    10691069                                                bp = split_bp(protocol)
    10701070                                                protocol = None
    1071                                                
     1071
    10721072                                                if (not interface in iface_properties):
    10731073                                                        iface_properties[interface] = {}
    1074                                                
     1074
    10751075                                                if ('protocol' in iface_properties[interface]):
    10761076                                                        print("%s: Protocol for interface '%s' already defined" % (inname, interface))
    10771077                                                else:
    10781078                                                        iface_properties[interface]['protocol'] = bp
    1079                                                
     1079
    10801080                                                output += "\n%s" % tabs(2)
    10811081                                                output += parse_bp(inname, bp, 2)
    10821082                                                output += "\n%s" % token
    10831083                                                indent = 0
    1084                                                
     1084
    10851085                                                context.remove(PROTOCOL)
    10861086                                                context.remove(BODY)
     
    10881088                                        else:
    10891089                                                protocol += token
    1090                                        
    1091                                         continue
    1092                                
     1090
     1091                                        continue
     1092
    10931093                                if (PROTOTYPE in context):
    10941094                                        if (FIN in context):
     
    10971097                                                else:
    10981098                                                        output += "%s" % token
    1099                                                
     1099
    11001100                                                context.remove(FIN)
    11011101                                                context.remove(PROTOTYPE)
    11021102                                                continue
    1103                                        
     1103
    11041104                                        if (PAR_RIGHT in context):
    11051105                                                if (token == ")"):
     
    11091109                                                else:
    11101110                                                        output += " %s" % token
    1111                                                
    1112                                                 continue
    1113                                        
     1111
     1112                                                continue
     1113
    11141114                                        if (SIGNATURE in context):
    11151115                                                output += "%s" % token
     
    11171117                                                        context.remove(SIGNATURE)
    11181118                                                        context.add(FIN)
    1119                                                
     1119
    11201120                                                context.remove(SIGNATURE)
    11211121                                                context.add(PAR_RIGHT)
    11221122                                                continue
    1123                                        
     1123
    11241124                                        if (PAR_LEFT in context):
    11251125                                                if (token != "("):
     
    11271127                                                else:
    11281128                                                        output += "%s" % token
    1129                                                
     1129
    11301130                                                context.remove(PAR_LEFT)
    11311131                                                context.add(SIGNATURE)
    11321132                                                continue
    1133                                        
     1133
    11341134                                        if (not identifier(token)):
    11351135                                                print("%s: Method identifier expected in interface '%s'" % (inname, interface))
    11361136                                        else:
    11371137                                                output += "%s" % token
    1138                                        
     1138
    11391139                                        context.add(PAR_LEFT)
    11401140                                        continue
    1141                                
     1141
    11421142                                if (token == "}"):
    11431143                                        if (indent != 2):
     
    11461146                                                indent = 0
    11471147                                                output += "\n%s" % token
    1148                                        
     1148
    11491149                                        context.remove(BODY)
    11501150                                        context.add(NULL)
    11511151                                        continue
    1152                                
     1152
    11531153                                if (token == "sysarg_t"):
    11541154                                        output += "\n%s%s " % (tabs(indent), token)
    11551155                                        context.add(PROTOTYPE)
    11561156                                        continue
    1157                                
     1157
    11581158                                if (token == "protocol:"):
    11591159                                        output += "\n%s%s" % (tabs(indent - 1), token)
     
    11621162                                        protocol = ""
    11631163                                        continue
    1164                                
     1164
    11651165                                print("%s: Unknown token '%s' in interface '%s'" % (inname, token, interface))
    11661166                                continue
    1167                        
     1167
    11681168                        if (HEAD in context):
    11691169                                if (PRE_BODY in context):
     
    11751175                                                context.add(BODY)
    11761176                                                continue
    1177                                        
     1177
    11781178                                        if (token == ";"):
    11791179                                                output += "%s\n" % token
     
    11821182                                                context.remove(IFACE)
    11831183                                                continue
    1184                                                
     1184
    11851185                                        print("%s: Expected '{' or ';' in interface head '%s'" % (inname, interface))
    11861186                                        continue
    1187                                
     1187
    11881188                                if (EXTENDS in context):
    11891189                                        if (not identifier(token)):
     
    11931193                                                if (not interface in iface_properties):
    11941194                                                        iface_properties[interface] = {}
    1195                                                
     1195
    11961196                                                iface_properties[interface]['extends'] = token
    1197                                        
     1197
    11981198                                        context.remove(EXTENDS)
    11991199                                        context.add(PRE_BODY)
    12001200                                        continue
    1201                                
     1201
    12021202                                if (token == "extends"):
    12031203                                        output += "%s " % token
    12041204                                        context.add(EXTENDS)
    12051205                                        continue
    1206                                        
     1206
    12071207                                if (token == "{"):
    12081208                                        output += "%s" % token
     
    12111211                                        context.add(BODY)
    12121212                                        continue
    1213                                
     1213
    12141214                                if (token == ";"):
    12151215                                        output += "%s\n" % token
     
    12171217                                        context.remove(IFACE)
    12181218                                        continue
    1219                                
     1219
    12201220                                print("%s: Expected 'extends', '{' or ';' in interface head '%s'" % (inname, interface))
    12211221                                continue
    1222                        
     1222
    12231223                        if (not identifier(token)):
    12241224                                print("%s: Expected interface name" % inname)
     
    12261226                                interface = token
    12271227                                output += "%s " % token
    1228                                
     1228
    12291229                                if (not interface in iface_properties):
    12301230                                        iface_properties[interface] = {}
    1231                                
     1231
    12321232                                iface_properties[interface]['name'] = interface
    1233                        
     1233
    12341234                        context.add(HEAD)
    12351235                        continue
    1236                
     1236
    12371237                # "architecture"
    1238                
     1238
    12391239                if (ARCH in context):
    12401240                        if (NULL in context):
     
    12431243                                else:
    12441244                                        output += "%s\n" % token
    1245                                
     1245
    12461246                                context.remove(NULL)
    12471247                                context.remove(ARCH)
     
    12491249                                architecture = None
    12501250                                continue
    1251                        
     1251
    12521252                        if (BODY in context):
    12531253                                if (DELEGATE in context):
     
    12571257                                                else:
    12581258                                                        output += "%s" % token
    1259                                                
     1259
    12601260                                                context.remove(FIN)
    12611261                                                context.remove(DELEGATE)
    12621262                                                continue
    1263                                        
     1263
    12641264                                        if (VAR in context):
    12651265                                                if (not descriptor(token)):
     
    12681268                                                        if (not architecture in arch_properties):
    12691269                                                                arch_properties[architecture] = {}
    1270                                                        
     1270
    12711271                                                        if (not 'delegate' in arch_properties[architecture]):
    12721272                                                                arch_properties[architecture]['delegate'] = []
    1273                                                        
     1273
    12741274                                                        arch_properties[architecture]['delegate'].append({'from': arg0, 'to': token.split(":")})
    12751275                                                        arg0 = None
    1276                                                        
     1276
    12771277                                                        output += "%s" % token
    1278                                                
     1278
    12791279                                                context.add(FIN)
    12801280                                                context.remove(VAR)
    12811281                                                continue
    1282                                        
     1282
    12831283                                        if (TO in context):
    12841284                                                if (token != "to"):
     
    12861286                                                else:
    12871287                                                        output += "%s " % token
    1288                                                
     1288
    12891289                                                context.add(VAR)
    12901290                                                context.remove(TO)
    12911291                                                continue
    1292                                        
     1292
    12931293                                        if (not identifier(token)):
    12941294                                                print("%s: Expected interface name in architecture '%s'" % (inname, architecture))
     
    12961296                                                output += "%s " % token
    12971297                                                arg0 = token
    1298                                        
     1298
    12991299                                        context.add(TO)
    13001300                                        continue
    1301                                
     1301
    13021302                                if (SUBSUME in context):
    13031303                                        if (FIN in context):
     
    13061306                                                else:
    13071307                                                        output += "%s" % token
    1308                                                
     1308
    13091309                                                context.remove(FIN)
    13101310                                                context.remove(SUBSUME)
    13111311                                                continue
    1312                                        
     1312
    13131313                                        if (VAR in context):
    13141314                                                if (not identifier(token)):
     
    13171317                                                        if (not architecture in arch_properties):
    13181318                                                                arch_properties[architecture] = {}
    1319                                                        
     1319
    13201320                                                        if (not 'subsume' in arch_properties[architecture]):
    13211321                                                                arch_properties[architecture]['subsume'] = []
    1322                                                        
     1322
    13231323                                                        arch_properties[architecture]['subsume'].append({'from': arg0.split(":"), 'to': token})
    13241324                                                        arg0 = None
    1325                                                        
     1325
    13261326                                                        output += "%s" % token
    1327                                                
     1327
    13281328                                                context.add(FIN)
    13291329                                                context.remove(VAR)
    13301330                                                continue
    1331                                        
     1331
    13321332                                        if (TO in context):
    13331333                                                if (token != "to"):
     
    13351335                                                else:
    13361336                                                        output += "%s " % token
    1337                                                
     1337
    13381338                                                context.add(VAR)
    13391339                                                context.remove(TO)
    13401340                                                continue
    1341                                        
     1341
    13421342                                        if (not descriptor(token)):
    13431343                                                print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
     
    13451345                                                output += "%s " % token
    13461346                                                arg0 = token
    1347                                        
     1347
    13481348                                        context.add(TO)
    13491349                                        continue
    1350                                
     1350
    13511351                                if (BIND in context):
    13521352                                        if (FIN in context):
     
    13551355                                                else:
    13561356                                                        output += "%s" % token
    1357                                                
     1357
    13581358                                                context.remove(FIN)
    13591359                                                context.remove(BIND)
    13601360                                                continue
    1361                                        
     1361
    13621362                                        if (VAR in context):
    13631363                                                if (not descriptor(token)):
     
    13661366                                                        if (not architecture in arch_properties):
    13671367                                                                arch_properties[architecture] = {}
    1368                                                        
     1368
    13691369                                                        if (not 'bind' in arch_properties[architecture]):
    13701370                                                                arch_properties[architecture]['bind'] = []
    1371                                                        
     1371
    13721372                                                        arch_properties[architecture]['bind'].append({'from': arg0.split(":"), 'to': token.split(":")})
    13731373                                                        arg0 = None
    1374                                                        
     1374
    13751375                                                        output += "%s" % token
    1376                                                
     1376
    13771377                                                context.add(FIN)
    13781378                                                context.remove(VAR)
    13791379                                                continue
    1380                                        
     1380
    13811381                                        if (TO in context):
    13821382                                                if (token != "to"):
     
    13841384                                                else:
    13851385                                                        output += "%s " % token
    1386                                                
     1386
    13871387                                                context.add(VAR)
    13881388                                                context.remove(TO)
    13891389                                                continue
    1390                                        
     1390
    13911391                                        if (not descriptor(token)):
    13921392                                                print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
     
    13941394                                                output += "%s " % token
    13951395                                                arg0 = token
    1396                                        
     1396
    13971397                                        context.add(TO)
    13981398                                        continue
    1399                                
     1399
    14001400                                if (INST in context):
    14011401                                        if (FIN in context):
     
    14041404                                                else:
    14051405                                                        output += "%s" % token
    1406                                                
     1406
    14071407                                                context.remove(FIN)
    14081408                                                context.remove(INST)
    14091409                                                continue
    1410                                        
     1410
    14111411                                        if (VAR in context):
    14121412                                                if (not identifier(token)):
     
    14151415                                                        if (not architecture in arch_properties):
    14161416                                                                arch_properties[architecture] = {}
    1417                                                        
     1417
    14181418                                                        if (not 'inst' in arch_properties[architecture]):
    14191419                                                                arch_properties[architecture]['inst'] = []
    1420                                                        
     1420
    14211421                                                        arch_properties[architecture]['inst'].append({'type': arg0, 'var': token})
    14221422                                                        arg0 = None
    1423                                                        
     1423
    14241424                                                        output += "%s" % token
    1425                                                
     1425
    14261426                                                context.add(FIN)
    14271427                                                context.remove(VAR)
    14281428                                                continue
    1429                                        
     1429
    14301430                                        if (not identifier(token)):
    14311431                                                print("%s: Expected frame/architecture type in architecture '%s'" % (inname, architecture))
     
    14331433                                                output += "%s " % token
    14341434                                                arg0 = token
    1435                                        
     1435
    14361436                                        context.add(VAR)
    14371437                                        continue
    1438                                
     1438
    14391439                                if (token == "}"):
    14401440                                        if (indent != 1):
     
    14431443                                                indent -= 1
    14441444                                                output += "\n%s" % token
    1445                                        
     1445
    14461446                                        context.remove(BODY)
    14471447                                        context.add(NULL)
    14481448                                        continue
    1449                                
     1449
    14501450                                if (token == "inst"):
    14511451                                        output += "\n%s%s " % (tabs(indent), token)
    14521452                                        context.add(INST)
    14531453                                        continue
    1454                                
     1454
    14551455                                if (token == "bind"):
    14561456                                        output += "\n%s%s " % (tabs(indent), token)
    14571457                                        context.add(BIND)
    14581458                                        continue
    1459                                
     1459
    14601460                                if (token == "subsume"):
    14611461                                        output += "\n%s%s " % (tabs(indent), token)
    14621462                                        context.add(SUBSUME)
    14631463                                        continue
    1464                                
     1464
    14651465                                if (token == "delegate"):
    14661466                                        output += "\n%s%s " % (tabs(indent), token)
    14671467                                        context.add(DELEGATE)
    14681468                                        continue
    1469                                
     1469
    14701470                                print("%s: Unknown token '%s' in architecture '%s'" % (inname, token, architecture))
    14711471                                continue
    1472                        
     1472
    14731473                        if (HEAD in context):
    14741474                                if (token == "{"):
     
    14781478                                        context.add(BODY)
    14791479                                        continue
    1480                                
     1480
    14811481                                if (token == ";"):
    14821482                                        output += "%s\n" % token
     
    14851485                                        context.discard(SYSTEM)
    14861486                                        continue
    1487                                
     1487
    14881488                                if (not word(token)):
    14891489                                        print("%s: Expected word in architecture head '%s'" % (inname, architecture))
    14901490                                else:
    14911491                                        output += "%s " % token
    1492                                
     1492
    14931493                                continue
    1494                        
     1494
    14951495                        if (not identifier(token)):
    14961496                                print("%s: Expected architecture name" % inname)
     
    14981498                                architecture = token
    14991499                                output += "%s " % token
    1500                                
     1500
    15011501                                if (not architecture in arch_properties):
    15021502                                        arch_properties[architecture] = {}
    1503                                
     1503
    15041504                                arch_properties[architecture]['name'] = architecture
    1505                                
     1505
    15061506                                if (SYSTEM in context):
    15071507                                        arch_properties[architecture]['system'] = True
    1508                        
     1508
    15091509                        context.add(HEAD)
    15101510                        continue
    1511                
     1511
    15121512                # "system architecture"
    1513                
     1513
    15141514                if (SYSTEM in context):
    15151515                        if (token != "architecture"):
     
    15171517                        else:
    15181518                                output += "%s " % token
    1519                        
     1519
    15201520                        context.add(ARCH)
    15211521                        continue
    1522                
     1522
    15231523                if (token == "frame"):
    15241524                        output += "\n%s " % token
    15251525                        context.add(FRAME)
    15261526                        continue
    1527                
     1527
    15281528                if (token == "interface"):
    15291529                        output += "\n%s " % token
    15301530                        context.add(IFACE)
    15311531                        continue
    1532                
     1532
    15331533                if (token == "system"):
    15341534                        output += "\n%s " % token
    15351535                        context.add(SYSTEM)
    15361536                        continue
    1537                
     1537
    15381538                if (token == "architecture"):
    15391539                        output += "\n%s " % token
    15401540                        context.add(ARCH)
    15411541                        continue
    1542                
     1542
    15431543                print("%s: Unknown token '%s'" % (inname, token))
    1544        
     1544
    15451545        inf.close()
    15461546
    15471547def open_adl(base, root, inname, outdir, outname):
    15481548        "Open Architecture Description file"
    1549        
     1549
    15501550        global output
    15511551        global context
     
    15561556        global initialization
    15571557        global finalization
    1558        
     1558
    15591559        global arg0
    1560        
     1560
    15611561        global opt_adl
    1562        
     1562
    15631563        output = ""
    15641564        context = set()
     
    15701570        finalization = None
    15711571        arg0 = None
    1572        
     1572
    15731573        parse_adl(base, root, inname, False, 0)
    15741574        output = output.strip()
    1575        
     1575
    15761576        if ((output != "") and (opt_adl)):
    15771577                outf = open(outname, "w")
     
    15811581def recursion(base, root, output, level):
    15821582        "Recursive directory walk"
    1583        
     1583
    15841584        for name in os.listdir(root):
    15851585                canon = os.path.join(root, name)
    1586                
     1586
    15871587                if (os.path.isfile(canon)):
    15881588                        fcomp = split_tokens(canon, ["."])
    15891589                        cname = canon.split("/")
    1590                        
     1590
    15911591                        if (fcomp[-1] == ".adl"):
    15921592                                output_path = os.path.join(output, cname[-1])
    15931593                                open_adl(base, root, canon, output, output_path)
    1594                
     1594
    15951595                if (os.path.isdir(canon)):
    15961596                        recursion(base, canon, output, level + 1)
     
    15981598def merge_dot_frame(prefix, name, frame, outf, indent):
    15991599        "Dump Dot frame"
    1600        
     1600
    16011601        outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix))
    16021602        outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name))
     
    16051605        outf.write("%s\tfillcolor=yellow;\n" % tabs(indent))
    16061606        outf.write("%s\t\n" % tabs(indent))
    1607        
     1607
    16081608        if ('provides' in frame):
    16091609                outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, style=filled, color=green, fillcolor=yellow];\n" % (tabs(indent), prefix))
    1610        
     1610
    16111611        if ('requires' in frame):
    16121612                outf.write("%s\t%s__requires [label=\"\", shape=circle, style=filled, color=red, fillcolor=yellow];\n" % (tabs(indent), prefix))
    1613        
     1613
    16141614        outf.write("%s}\n" % tabs(indent))
    16151615        outf.write("%s\n" % tabs(indent))
     
    16171617def merge_dot_arch(prefix, name, arch, outf, indent):
    16181618        "Dump Dot subarchitecture"
    1619        
     1619
    16201620        outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix))
    16211621        outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name))
    16221622        outf.write("%s\tcolor=red;\n" % tabs(indent))
    16231623        outf.write("%s\t\n" % tabs(indent))
    1624        
     1624
    16251625        if ('inst' in arch):
    16261626                for inst in arch['inst']:
     
    16341634                                else:
    16351635                                        print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
    1636        
     1636
    16371637        if ('bind' in arch):
    16381638                labels = {}
     
    16421642                        else:
    16431643                                label = bind['from'][1]
    1644                        
     1644
    16451645                        if (not (bind['from'][0], bind['to'][0]) in labels):
    16461646                                labels[(bind['from'][0], bind['to'][0])] = []
    1647                        
     1647
    16481648                        labels[(bind['from'][0], bind['to'][0])].append(label)
    1649                
     1649
    16501650                for bind in arch['bind']:
    16511651                        if (not (bind['from'][0], bind['to'][0]) in labels):
    16521652                                continue
    1653                        
     1653
    16541654                        attrs = []
    1655                        
     1655
    16561656                        if (bind['from'][0] != bind['to'][0]):
    16571657                                attrs.append("ltail=cluster_%s_%s" % (prefix, bind['from'][0]))
    16581658                                attrs.append("lhead=cluster_%s_%s" % (prefix, bind['to'][0]))
    1659                        
     1659
    16601660                        attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])]))
    16611661                        del labels[(bind['from'][0], bind['to'][0])]
    1662                        
     1662
    16631663                        outf.write("%s\t%s_%s__requires -> %s_%s__provides [%s];\n" % (tabs(indent), prefix, bind['from'][0], prefix, bind['to'][0], ", ".join(attrs)))
    1664        
     1664
    16651665        if ('delegate' in arch):
    16661666                outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, color=green];\n" % (tabs(indent), prefix))
    1667                
     1667
    16681668                labels = {}
    16691669                for delegate in arch['delegate']:
     
    16721672                        else:
    16731673                                label = delegate['from']
    1674                        
     1674
    16751675                        if (not delegate['to'][0] in labels):
    16761676                                labels[delegate['to'][0]] = []
    1677                        
     1677
    16781678                        labels[delegate['to'][0]].append(label)
    1679                
     1679
    16801680                for delegate in arch['delegate']:
    16811681                        if (not delegate['to'][0] in labels):
    16821682                                continue
    1683                        
     1683
    16841684                        attrs = []
    16851685                        attrs.append("color=gray")
     
    16871687                        attrs.append("label=\"%s\"" % "\\n".join(labels[delegate['to'][0]]))
    16881688                        del labels[delegate['to'][0]]
    1689                        
     1689
    16901690                        outf.write("%s\t%s__provides -> %s_%s__provides [%s];\n" % (tabs(indent), prefix, prefix, delegate['to'][0], ", ".join(attrs)))
    1691        
     1691
    16921692        if ('subsume' in arch):
    16931693                outf.write("%s\t%s__requires [label=\"\", shape=circle, color=red];\n" % (tabs(indent), prefix))
    1694                
     1694
    16951695                labels = {}
    16961696                for subsume in arch['subsume']:
     
    16991699                        else:
    17001700                                label = subsume['to']
    1701                        
     1701
    17021702                        if (not subsume['from'][0] in labels):
    17031703                                labels[subsume['from'][0]] = []
    1704                        
     1704
    17051705                        labels[subsume['from'][0]].append(label)
    1706                
     1706
    17071707                for subsume in arch['subsume']:
    17081708                        if (not subsume['from'][0] in labels):
    17091709                                continue
    1710                        
     1710
    17111711                        attrs = []
    17121712                        attrs.append("color=gray")
     
    17141714                        attrs.append("label=\"%s\"" % "\\n".join(labels[subsume['from'][0]]))
    17151715                        del labels[subsume['from'][0]]
    1716                        
     1716
    17171717                        outf.write("%s\t%s_%s__requires -> %s__requires [%s];\n" % (tabs(indent), prefix, subsume['from'][0], prefix, ", ".join(attrs)))
    1718        
     1718
    17191719        outf.write("%s}\n" % tabs(indent))
    17201720        outf.write("%s\n" % tabs(indent))
     
    17221722def dump_dot(outdir):
    17231723        "Dump Dot architecture"
    1724        
     1724
    17251725        global opt_dot
    1726        
     1726
    17271727        arch = get_system_arch()
    1728        
     1728
    17291729        if (arch is None):
    17301730                print("Unable to find system architecture")
    17311731                return
    1732        
     1732
    17331733        if (opt_dot):
    17341734                outname = os.path.join(outdir, "%s.dot" % arch['name'])
    17351735                outf = open(outname, "w")
    1736                
     1736
    17371737                outf.write("digraph {\n")
    17381738                outf.write("\tlabel=\"%s\";\n" % arch['name'])
     
    17411741                outf.write("\tedge [fontsize=8];\n")
    17421742                outf.write("\t\n")
    1743                
     1743
    17441744                if ('inst' in arch):
    17451745                        for inst in arch['inst']:
     
    17531753                                        else:
    17541754                                                print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
    1755                
     1755
    17561756                if ('bind' in arch):
    17571757                        labels = {}
     
    17611761                                else:
    17621762                                        label = bind['from'][1]
    1763                                
     1763
    17641764                                if (not (bind['from'][0], bind['to'][0]) in labels):
    17651765                                        labels[(bind['from'][0], bind['to'][0])] = []
    1766                                
     1766
    17671767                                labels[(bind['from'][0], bind['to'][0])].append(label)
    1768                        
     1768
    17691769                        for bind in arch['bind']:
    17701770                                if (not (bind['from'][0], bind['to'][0]) in labels):
    17711771                                        continue
    1772                                
     1772
    17731773                                attrs = []
    1774                                
     1774
    17751775                                if (bind['from'][0] != bind['to'][0]):
    17761776                                        attrs.append("ltail=cluster_%s" % bind['from'][0])
    17771777                                        attrs.append("lhead=cluster_%s" % bind['to'][0])
    1778                                
     1778
    17791779                                attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])]))
    17801780                                del labels[(bind['from'][0], bind['to'][0])]
    1781                                
     1781
    17821782                                outf.write("\t%s__requires -> %s__provides [%s];\n" % (bind['from'][0], bind['to'][0], ", ".join(attrs)))
    1783                
     1783
    17841784                if ('delegate' in arch):
    17851785                        for delegate in arch['delegate']:
    17861786                                print("Unable to delegate interface in system architecture")
    17871787                                break
    1788                
     1788
    17891789                if ('subsume' in arch):
    17901790                        for subsume in arch['subsume']:
    17911791                                print("Unable to subsume interface in system architecture")
    17921792                                break
    1793                
     1793
    17941794                outf.write("}\n")
    1795                
     1795
    17961796                outf.close()
    17971797
     
    18041804        global opt_adl
    18051805        global opt_dot
    1806        
     1806
    18071807        if (len(sys.argv) < 3):
    18081808                usage(sys.argv[0])
    18091809                return
    1810        
     1810
    18111811        opt_bp = False
    18121812        opt_ebp = False
    18131813        opt_adl = False
    18141814        opt_dot = False
    1815        
     1815
    18161816        for arg in sys.argv[1:(len(sys.argv) - 1)]:
    18171817                if (arg == "--bp"):
     
    18281828                        print("Error: Unknown command line option '%s'" % arg)
    18291829                        return
    1830        
     1830
    18311831        if ((opt_bp) and (opt_ebp)):
    18321832                print("Error: Cannot dump both original Behavior Protocols and Extended Behavior Protocols")
    18331833                return
    1834        
     1834
    18351835        path = os.path.abspath(sys.argv[-1])
    18361836        if (not os.path.isdir(path)):
    18371837                print("Error: <OUTPUT> is not a directory")
    18381838                return
    1839        
     1839
    18401840        iface_properties = {}
    18411841        frame_properties = {}
    18421842        arch_properties = {}
    1843        
     1843
    18441844        recursion(".", ".", path, 0)
    18451845        dump_archbp(path)
  • contrib/arch/kernel/kernel.adl

    r3061bc1 r8565a42  
    1313                /* Enable kernel console */
    1414                sysarg_t sys_debug_enable_console(void);
    15                
     15
    1616                /* Disable kernel console */
    1717                sysarg_t sys_debug_disable_console(void);
     
    2626                /* Create new thread */
    2727                sysarg_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, size_t name_len, thread_id_t *uspace_thread_id);
    28                
     28
    2929                /* Terminate current thread */
    3030                sysarg_t sys_thread_exit(int uspace_status);
    31                
     31
    3232                /* Get current thread id */
    3333                sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id);
     
    4343                /* Set name fo the current task */
    4444                sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len);
    45                
     45
    4646                /* Get current task id */
    4747                sysarg_t sys_task_get_id(task_id_t *uspace_task_id);
     
    6363                /* Sleep in a futex wait queue */
    6464                sysarg_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags);
    65                
     65
    6666                /* Wakeup one thread waiting in futex wait queue */
    6767                sysarg_t sys_futex_wakeup(uintptr_t uaddr);
     
    8383                /* Create new address space area */
    8484                sysarg_t sys_as_area_create(uintptr_t address, size_t size, int flags);
    85                
     85
    8686                /* Resize an address space area */
    8787                sysarg_t sys_as_area_resize(uinptr_t address, size_t size, int flags);
    88                
     88
    8989                /* Change flags of an address space area */
    9090                sysarg_t sys_as_area_change_flags(uintptr_t address, int flags);
    91                
     91
    9292                /* Destroy an address space area */
    9393                sysarg_t sys_as_area_destroy(uintptr_t address);
     
    104104                /* Fast synchronous IPC call */
    105105                sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data);
    106                
     106
    107107                /* Slow synchronous IPC call */
    108108                sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *question, ipc_data_t *answer);
    109                
     109
    110110                /* Fast asynchronous IPC call */
    111111                sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
    112                
     112
    113113                /* Slow asynchronous IPC call */
    114114                sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data);
    115                
     115
    116116                /* Fast forward a received IPC call to another destination */
    117117                sysarg_t sys_ipc_forward_fast(sysarg_t callid, sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, int mode);
    118                
     118
    119119                /* Slow forward a received IPC call to another destination */
    120120                sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid, ipc_data_t *data, int mode);
    121                
     121
    122122                /* Fast answer an IPC call */
    123123                sysarg_t sys_ipc_answer_fast(sysarg_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
    124                
     124
    125125                /* Slow answer an IPC call */
    126126                sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data);
    127                
     127
    128128                /* Hang up a phone */
    129129                sysarg_t sys_ipc_hangup(int phoneid);
    130                
     130
    131131                /* Wait for an incoming IPC call or answer */
    132132                sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, int flags);
    133                
     133
    134134                /* Interrupt one thread of the current task from waiting on IPC call */
    135135                sysarg_t sys_ipc_poke(void);
     
    162162                sysarg_t sys_cap_grant(sysarg64_t *uspace_taskid, cap_t caps);
    163163#endif
    164                
     164
    165165#ifdef __64_BITS__
    166166                sysarg_t sys_cap_grant(sysarg_t taskid, cap_t caps);
    167167#endif
    168                
     168
    169169                /* Revoke capabilities from a task */
    170170#ifdef __32_BITS__
    171171                sysarg_t sys_cap_revoke(sysarg64_t *uspace_taskid, cap_t caps);
    172172#endif
    173                
     173
    174174#ifdef __64_BITS__
    175175                sysarg_t sys_cap_revoke(sysarg_t taskid, cap_t caps);
     
    185185                /* Enable access I/O address space for the current task */
    186186                sysarg_t sys_enable_iospace(ddi_ioarg_t *uspace_io_arg);
    187                
     187
    188188                /* Map physical memory to the current task's address space */
    189189                sysarg_t sys_physmem_map(sysarg_t phys_base, sysarg_t virt_base, sysarg_t pages, sysarg_t flags);
    190                
     190
    191191                /* Enable or disable preemption */
    192192                sysarg_t sys_preempt_control(int enable);
    193                
     193
    194194                /* Assign unique device number */
    195195                sysarg_t sys_device_assign_devno(void);
    196                
     196
    197197                /* Connect an IRQ handler to the current task */
    198198                sysarg_t sys_register_irq(inr_t inr, devno_t devno, sysarg_t method, irq_code_t *ucode);
    199                
     199
    200200                /* Disconnect an IRQ handler from the current task */
    201201                sysarg_t sys_unregister_irq(inr_t inr, devno_t devno);
     
    214214                /* Check for sysinfo key validity */
    215215                sysarg_t sys_sysinfo_valid(sysarg_t ptr, sysarg_t len);
    216                
     216
    217217                /* Get sysinfo key value */
    218218                sysarg_t sys_sysinfo_value(unatice_t ptr, sysarg_t len);
     
    229229                sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid);
    230230#endif
    231                
     231
    232232#ifdef __64_BITS__
    233233                sysarg_t sys_ipc_connect_kbox(sysarg_t taskid);
     
    308308        inst sys_sysinfo sys_sysinfo;
    309309        inst sys_debug sys_debug;
    310        
     310
    311311        delegate sys_kio to sys_console:sys_kio;
    312312        delegate sys_console to sys_console:sys_console;
  • contrib/arch/uspace/srv/bd/bd.adl

    r3061bc1 r8565a42  
    22                /* Share out data buffer */
    33                sysarg_t ipc_m_share_out(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t flags, out sysarg_t dst_as_area_base);
    4                
     4
    55                /* Get block size */
    66                sysarg_t get_block_size(out sysarg_t block_size);
    7                
     7
    88                /* Read blocks via shared data buffer */
    99                sysarg_t read_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count);
    10                
     10
    1111                /* Write blocks via shared data buffer */
    1212                sysarg_t write_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count);
     
    1717architecture bd {
    1818        inst rd rd;
    19        
     19
    2020        [/uspace/lib/libc/subsume%rd]
    21        
     21
    2222        delegate rd to rd:rd;
    23        
     23
    2424        subsume rd:ns to ns;
    2525        subsume rd:devmap_driver to devmap_driver;
  • contrib/arch/uspace/srv/console/console.adl

    r3061bc1 r8565a42  
    22                /* Read characters from console */
    33                sysarg_t read(out_copy stream data);
    4                
     4
    55                /* Write characters to console */
    66                sysarg_t write(in_copy stream data);
    7                
     7
    88                /* Get last event from event queue */
    99                sysarg_t get_event(out sysarg_t type, out sysarg_t key, out sysarg_t mods, out sysarg_t char);
    10                
     10
    1111                /* Flush output buffer */
    1212                sysarg_t sync(void);
    13                
     13
    1414                /* Clear console */
    1515                sysarg_t clear(void);
    16                
     16
    1717                /* Move cursor to given position */
    1818                sysarg_t goto(in sysarg_t col, in sysarg_t row);
    19                
     19
    2020                /* Get console dimensions (in character cells) */
    2121                sysarg_t get_size(out sysarg_t cols, in sysarg_t rows);
    22                
     22
    2323                /* Get color capabilities */
    2424                sysarg_t get_color_cap(void);
    25                
     25
    2626                /* Set abstract text style */
    2727                sysarg_t set_style(in sysarg_t style);
    28                
     28
    2929                /* Set EGA-based text color */
    3030                sysarg_t set_color(in sysarg_t fb_color, in sysarg_t bg_color, in sysarg_t attr);
    31                
     31
    3232                /* Set RGB-based text color */
    3333                sysarg_t set_rgb_color(in sysarg_t fb_color, in sysarg_t bg_color);
    34                
     34
    3535                /* Set cursor visibility */
    3636                sysarg_t cursor_visibility(in sysarg_t visible);
    37                
     37
    3838                /* Switch to kernel debugging console (if available) */
    3939                sysarg_t kcon_enable(void);
     
    8585        inst kbd kbd;
    8686        inst fb fb;
    87        
     87
    8888        bind ui_dispatcher:kbd to kbd:kbd;
    8989        bind ui_dispatcher:fb to fb:fb;
    90        
     90
    9191        bind kbd:event to ui_dispatcher:event;
    92        
     92
    9393        delegate console to ui_dispatcher:console;
    9494        delegate kbd to kbd:kbd;
    9595        delegate fb to fb:fb;
    96        
     96
    9797        [/uspace/lib/libc/subsume%ui_dispatcher]
    9898        [/uspace/lib/libc/subsume%kbd]
    9999        [/uspace/lib/libc/subsume%fb]
    100        
     100
    101101        subsume ui_dispatcher:ns to ns;
    102102        subsume ui_dispatcher:devmap_driver to devmap_driver;
    103103        subsume ui_dispatcher:sys_console to sys_console;
    104        
     104
    105105        subsume kbd:ns to ns;
    106106        subsume fb:ns to ns;
  • contrib/arch/uspace/srv/console/console.bp

    r3061bc1 r8565a42  
    55                [fnc.cons_read]
    66        } +
    7        
     7
    88        ?write {
    99                [fnc.cons_write]
    1010        } +
    11        
     11
    1212        ?sync {
    1313                [fnc.fb_pending_flush] ;
     
    1717                }
    1818        } +
    19        
     19
    2020        ?clear {
    2121                tentative {
     
    2323                }
    2424        } +
    25        
     25
    2626        ?goto {
    2727                tentative {
     
    2929                }
    3030        } +
    31        
     31
    3232        ?set_style {
    3333                [fnc.fb_pending_flush] ;
     
    3636                }
    3737        } +
    38        
     38
    3939        ?set_color {
    4040                [fnc.fb_pending_flush] ;
     
    4343                }
    4444        } +
    45        
     45
    4646        ?set_rgb_color {
    4747                [fnc.fb_pending_flush] ;
     
    5050                }
    5151        } +
    52        
     52
    5353        ?cursor_visibility {
    5454                [fnc.fb_pending_flush] ;
     
    5757                }
    5858        } +
    59        
     59
    6060        ?kcon_enable {
    6161                !sys_console.sys_debug_enable_console
    6262        } +
    63        
     63
    6464        ?get_event +
    6565        ?get_size +
  • contrib/arch/uspace/srv/devmap/devmap.adl

    r3061bc1 r8565a42  
    22                /* Establish connection (iface is DEVMAP_DRIVER) */
    33                sysarg_t ipc_m_connect_me_to(in sysarg_t iface);
    4                
     4
    55                /* Register as a new driver */
    66                sysarg_t driver_register(in_copy string name);
    7                
     7
    88                /* Unregister all devices and the driver itself */
    99                sysarg_t driver_unregister(void);
    10                
     10
    1111                /* Register new device and return handle */
    1212                sysarg_t device_register(in_copy string name, out sysarg_t handle);
    13                
     13
    1414                /* Unregister device */
    1515                sysarg_t device_unregister(in sysarg_t handle);
    16                
     16
    1717                /* Resolve device name to handle */
    1818                sysarg_t device_get_handle(in sysarg_t flags, in_copy string name);
    19                
     19
    2020                /* Get device name for a given handle */
    2121                sysarg_t device_get_name(in sysarg_t handle);
    22                
     22
    2323                /* Close connection */
    2424                sysarg_t ipc_m_phone_hungup(void);
     
    3030                /* Establish connection (iface is DEVMAP_CLIENT) or forward to device (iface is DEVMAP_CONNECT_TO_DEVICE) */
    3131                sysarg_t ipc_m_connect_me_to(in sysarg_t iface, in sysarg_t handle);
    32                
     32
    3333                /* Resolve device name to handle */
    3434                sysarg_t device_get_handle(in sysarg_t flags, in_copy string name);
    35                
     35
    3636                /* Get device name for a given handle */
    3737                sysarg_t device_get_name(in sysarg_t handle);
    38                
     38
    3939                /* Clone NULL device */
    4040                sysarg_t device_null_create(out sysarg_t index);
    41                
     41
    4242                /* Destroy NULL device */
    4343                sysarg_t device_null_destroy(in sysarg_t index);
    44                
     44
    4545                /* Get number of devices */
    4646                sysarg_t device_get_count(out sysarg_t count);
    47                
     47
    4848                /* Get an array of (device_name, handle) pairs */
    4949                sysarg_t device_get_devices(out_copy stream data);
    50                
     50
    5151                /* Close connection */
    5252                sysarg_t ipc_m_phone_hungup(void);
    5353        protocol:
    5454                [devmap_client.bp]
    55        
     55
    5656};
    5757
  • contrib/arch/uspace/srv/devmap/devmap_client.bp

    r3061bc1 r8565a42  
    1010                        ?ipc_m_data_write /* device name */
    1111                } +
    12                
     12
    1313                ?device_get_name +
    1414                ?device_null_create +
    1515                ?device_null_destroy +
    1616                ?device_get_count +
    17                
     17
    1818                ?device_get_devices {
    1919                        ?ipc_m_data_read /* buffer */
  • contrib/arch/uspace/srv/devmap/devmap_driver.bp

    r3061bc1 r8565a42  
    1414                }
    1515        } +
    16        
     16
    1717        ?device_get_handle {
    1818                ?ipc_m_data_write /* device name */
    1919        } +
    20        
     20
    2121        ?device_get_name +
    2222        ?device_unregister +
  • contrib/arch/uspace/srv/fb/fb.adl

    r3061bc1 r8565a42  
    22                /* Get screen resolution */
    33                sysarg_t get_resolution(out sysarg_t width, out sysarg_t height);
    4                
     4
    55                /* Yield screen */
    66                sysarg_t screen_yield(void);
    7                
     7
    88                /* Reclaim screen */
    99                sysarg_t screen_reclaim(void);
    10                
     10
    1111                /* Set mouse cursor position on screen */
    1212                sysarg_t pointer_move(in sysarg_t x, in sysarg_t y);
    13                
     13
    1414                /* Create new viewport */
    1515                sysarg_t viewport_create(in sysarg_t origin, in sysarg_t dimension);
    16                
     16
    1717                /* Get viewport size in character cells */
    1818                sysarg_t get_csize(out sysarg_t width, out sysarg_t height);
    19                
     19
    2020                /* Clear viewport character buffer */
    2121                sysarg_t clear(void);
    22                
     22
    2323                /* Scroll viewport character buffer */
    2424                sysarg_t scroll(in sysarg_t lines);
    25                
     25
    2626                /* Set active viewport */
    2727                sysarg_t viewport_switch(in sysarg_t index);
    28                
     28
    2929                /* Delete viewport */
    3030                sysarg_t viewport_delete(in sysarg_t index);
    31                
     31
    3232                /* Get color capabilities of the screen */
    3333                sysarg_t get_color_cap(void);
    34                
     34
    3535                /* Set abstract text style */
    3636                sysarg_t set_style(in sysarg_t style);
    37                
     37
    3838                /* Set EGA-based text color */
    3939                sysarg_t set_color(in sysarg_t fg_color, in sysarg_t bg_color, in sysarg_t atrr);
    40                
     40
    4141                /* Set RGB-based text color */
    4242                sysarg_t set_rgb_color(in sysarg_t fg_color, in sysarg_t bg_color);
    43                
     43
    4444                /* Put a character to a given position in viewport character buffer */
    4545                sysarg_t putchar(in sysarg_t char, in sysarg_t col, in sysarg_t row);
    46                
     46
    4747                /* Set character cursor visibility in viewport */
    4848                sysarg_t cursor_visibility(in sysarg_t visible);
    49                
     49
    5050                /* Set character cursor position in viewport */
    5151                sysarg_t cursor_goto(in sysarg_t col, in sysarg_t row);
    52                
     52
    5353                /* Prepare memory sharing of bitmaps */
    5454                sysarg_t prepare_shm(in sysarg_t as_area_base);
    55                
     55
    5656                /* Share bitmap or text data */
    5757                sysarg_t ipc_m_share_out(in sysarg_t as_area_base, in sysarg_t as_area_size, out sysarg_t dst_as_area);
    58                
     58
    5959                /* Drop memory sharing */
    6060                sysarg_t drop_shm(void);
    61                
     61
    6262                /* Draw PPM data from shared memory to viewport */
    6363                sysarg_t draw_ppm(in sysarg_t x, in sysarg_t y);
    64                
     64
    6565                /* Put characters from shared memory to viewport */
    6666                sysarg_t draw_text_data(in sysarg_t x, in sysarg_t y, in sysarg_t width, in sysarg_t height);
    67                
     67
    6868                /* Convert PPM data from shared memory to pixmap */
    6969                sysarg_t shm2pixmap(void);
    70                
     70
    7171                /* Save viewport contents to a pixmap */
    7272                sysarg_t vp2pixmap(in sysarg_t vp_index);
    73                
     73
    7474                /* Draw pixmap to viewport */
    7575                sysarg_t vp_draw_pixmap(in sysarg_t vp_index, in sysarg_t pm_index);
    76                
     76
    7777                /* Discard pixmap */
    7878                sysarg_t drop_pixmap(in sysarg_t pm_index);
    79                
     79
    8080                /* Create new (empty) animation for a viewport */
    8181                sysarg_t anim_create(in sysarg_t vp_index);
    82                
     82
    8383                /* Append a pixmap to an animation */
    8484                sysarg_t anim_addpixmap(in sysarg_t anim_index, in sysarg_t pm_index);
    85                
     85
    8686                /* Change a viewport associated with an animation */
    8787                sysarg_t anim_chgvp(in sysarg_t anim_index, in sysarg_t vp_index);
    88                
     88
    8989                /* Start animation playback */
    9090                sysarg_t anim_start(in sysarg_t anim_index);
    91                
     91
    9292                /* Stop animation playback */
    9393                sysarg_t anim_stop(in sysarg_t anim_index);
    94                
     94
    9595                /* Delete animation */
    9696                sysarg_t anim_drop(in sysarg_t anim_index);
  • contrib/arch/uspace/srv/fs/devfs/devfs.bp

    r3061bc1 r8565a42  
    55                        ?ipc_m_data_write /* mount options */
    66                } +
    7                
     7
    88                ?lookup {
    99                        tentative {
     
    1414                        }
    1515                } +
    16                
     16
    1717                ?open_node {
    1818                        tentative {
     
    2020                        }
    2121                } +
    22                
     22
    2323                ?read {
    2424                        tentative {
     
    3434                        }
    3535                } +
    36                
     36
    3737                ?write {
    3838                        tentative {
     
    4444                        }
    4545                } +
    46                
     46
    4747                ?stat {
    4848                        ?ipc_m_data_read /* struct data */
    4949                } +
    50                
     50
    5151                ?close {
    5252                        !device.ipc_m_phone_hungup
    5353                } +
    54                
     54
    5555                ?mount +
    5656                ?truncate +
  • contrib/arch/uspace/srv/fs/fat/fat.bp

    r3061bc1 r8565a42  
    1010                        }
    1111                } +
    12                
     12
    1313                ?mount {
    1414                        [/uspace/lib/libfs/fnc.libfs_mount]
    1515                } +
    16                
     16
    1717                ?lookup {
    1818                        [/uspace/lib/libfs/fnc.libfs_lookup]
    1919                } +
    20                
     20
    2121                ?open_node {
    2222                        [/uspace/lib/libfs/fnc.libfs_open_node]
    2323                } +
    24                
     24
    2525                ?read {
    2626                        tentative {
     
    2828                        }
    2929                } +
    30                
     30
    3131                ?write {
    3232                        tentative {
     
    3434                        }
    3535                } +
    36                
     36
    3737                ?stat {
    3838                        [/uspace/lib/libfs/fnc.libfs_stat]
    3939                } +
    40                
     40
    4141                ?truncate +
    4242                ?close +
  • contrib/arch/uspace/srv/fs/tmpfs/tmpfs.bp

    r3061bc1 r8565a42  
    88                        }
    99                } +
    10                
     10
    1111                ?mount {
    1212                        [/uspace/lib/libfs/fnc.libfs_mount]
    1313                } +
    14                
     14
    1515                ?lookup {
    1616                        [/uspace/lib/libfs/fnc.libfs_lookup]
    1717                } +
    18                
     18
    1919                ?open_node {
    2020                        [/uspace/lib/libfs/fnc.libfs_open_node]
    2121                } +
    22                
     22
    2323                ?read {
    2424                        tentative {
     
    2626                        }
    2727                } +
    28                
     28
    2929                ?write {
    3030                        tentative {
     
    3232                        }
    3333                } +
    34                
     34
    3535                ?stat {
    3636                        [/uspace/lib/libfs/fnc.libfs_stat]
    3737                } +
    38                
     38
    3939                ?truncate +
    4040                ?close +
  • contrib/arch/uspace/srv/kbd/kbd.adl

    r3061bc1 r8565a42  
    22                /* Callback connection */
    33                sysarg_t ipc_m_connect_to_me(void);
    4                
     4
    55                /* Yield hardware */
    66                sysarg_t yield(void);
    7                
     7
    88                /* Reclaim hardware */
    99                sysarg_t reclaim(void);
  • contrib/arch/uspace/srv/loader/loader.adl

    r3061bc1 r8565a42  
    22                /* Set task pathname */
    33                sysarg_t set_pathname(in_copy string pathname);
    4                
     4
    55                /* Set task arguments */
    66                sysarg_t set_args(in_copy stream args);
    7                
     7
    88                /* Set task initial files */
    99                sysarg_t set_files(in_copy stream files);
    10                
     10
    1111                /* Get task ID */
    1212                sysarg_t get_taskid(out_copy stream id);
    13                
     13
    1414                /* Load binary */
    1515                sysarg_t load(void);
    16                
     16
    1717                /* Run binary */
    1818                sysarg_t run(void);
  • contrib/arch/uspace/srv/loader/loader.bp

    r3061bc1 r8565a42  
    33                ?ipc_m_data_read /* task ID */
    44        } +
    5        
     5
    66        ?set_pathname {
    77                ?ipc_m_data_write /* pathname */
    88        } +
    9        
     9
    1010        ?set_args {
    1111                ?ipc_m_data_write /* arguments */
    1212        } +
    13        
     13
    1414        ?set_files {
    1515                ?ipc_m_data_write /* files */
    1616        } +
    17        
     17
    1818        ?load
    1919)* ;
  • contrib/arch/uspace/srv/ns/ns.adl

    r3061bc1 r8565a42  
    22                /* Register a clonable service or a generic service */
    33                sysarg_t ipc_m_connect_to_me(in sysarg_t service);
    4                
     4
    55                /* Connect to a clonable service or a generic service */
    66                sysarg_t ipc_m_connect_me_to(in sysarg_t service, in sysarg_t arg2, in sysarg_t arg3, in sysarg_t flags);
    7                
     7
    88                /* Share real-time clock page or kio page */
    99                sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service);
    10                
     10
    1111                /* For IPC testing purposes */
    1212                sysarg_t ping(void);
    13                
     13
    1414                /* Wait for task exit and get exit status and return value */
    1515                sysarg_t task_wait(in sysarg_t id_lower, in sysarg_t id_upper, out sysarg_t status, out sysarg_t retval);
    16                
     16
    1717                /* Introduce a new loader task id in such a way it cannot be spoofed */
    1818                sysarg_t id_intro(in sysarg_t id_lower, in sysarg_t id_upper);
    19                
     19
    2020                /* Set task return value */
    2121                sysarg_t retval(in sysarg_t retval);
    22                
     22
    2323                /* Implicit connection close */
    2424                sysarg_t ipc_m_phone_hungup(void);
  • contrib/arch/uspace/srv/ns/ns.bp

    r3061bc1 r8565a42  
    88                }
    99        } +
    10        
     10
    1111        ?ipc_m_connect_me_to {
    1212                tentative {
     
    1616                }
    1717        } +
    18        
     18
    1919        ?ipc_m_share_in +
    2020        ?ping +
  • contrib/arch/uspace/srv/ns/service.adl

    r3061bc1 r8565a42  
    33                   (this call is forwarded from Naming Service or Device Mapper) */
    44                sysarg_t ipc_m_connect_me_to(void);
    5                
     5
    66                /* Close connection */
    77                sysarg_t ipc_m_phone_hungup(void);
  • contrib/arch/uspace/srv/vfs/vfs.adl

    r3061bc1 r8565a42  
    22                /* Register a filesystem driver */
    33                sysarg_t register(in_copy string name);
    4                
     4
    55                /* Mount filesystem */
    66                sysarg_t mount(in sysarg_t device, in sysarg_t flags, in sysarg_t instance, in_copy string point, in_copy string opts, in_copy string fs);
    7                
     7
    88                /* Open file */
    99                sysarg_t open(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, in_copy string path, out sysarg_t fd);
    10                
     10
    1111                /* Open file using node */
    1212                sysarg_t open_node(in sysarg_t fs_handle, in sysarg_t dev_handle, in sysarg_t index, in sysarg_t oflag, out sysarg_t fd);
    13                
     13
    1414                /* Read data from file */
    1515                sysarg_t read(in sysarg_t fd, out_copy stream data);
    16                
     16
    1717                /* Write data to file */
    1818                sysarg_t write(in sysarg_t fd, in_copy stream data);
    19                
     19
    2020                /* Seek in file */
    2121                sysarg_t seek(in sysarg_t fd, in sysarg_t offset, in sysarg_t whence);
    22                
     22
    2323                /* Truncate file */
    2424                sysarg_t truncate(in sysarg_t fd, in sysarg_t size);
    25                
     25
    2626                /* Get file metadata */
    2727                sysarg_t fstat(in sysarg_t fd, out_copy stream stat);
    28                
     28
    2929                /* Get directory entry metadata */
    3030                sysarg_t stat(in_copy string path, out_copy stream stat);
    31                
     31
    3232                /* Create directory */
    3333                sysarg_t mkdir(in sysarg_t mode, in_copy string path);
    34                
     34
    3535                /* Delete directory entry */
    3636                sysarg_t unlink(in sysarg_t lflag, in_copy string path);
    37                
     37
    3838                /* Rename directory entry */
    3939                sysarg_t rename(in_copy string old, in_copy string new);
    40                
     40
    4141                /* Flush file buffers */
    4242                sysarg_t sync(in sysarg_t fd);
    43                
     43
    4444                /* In-protocol status value */
    4545                sysarg_t ipc_m_ping(void);
    46                
     46
    4747                /* Close connection */
    4848                sysarg_t ipc_m_phone_hungup(void);
     
    5454                /* Notify filesystem that it was mounted */
    5555                sysarg_t mounted(in sysarg_t dev_handle, in_copy string opts);
    56                
     56
    5757                /* Mount filesystem */
    5858                sysarg_t mount(in sysarg_t device, in sysarg_t flags, in sysarg_t instance, in_copy string point, in_copy string opts, ...);
    59                
     59
    6060                /* Open file by node */
    6161                sysarg_t open_node(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...);
    62                
     62
    6363                /* Lookup file */
    6464                sysarg_t lookup(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...);
    65                
     65
    6666                /* Read data from file */
    6767                sysarg_t read(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, out_copy stream data);
    68                
     68
    6969                /* Write data to file */
    7070                sysarg_t write(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, in_copy stream data);
    71                
     71
    7272                /* Truncate file */
    7373                sysarg_t truncate(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t size);
    74                
     74
    7575                /* Get directory entry metadata */
    7676                sysarg_t stat(in sysarg_t dev_handle, in sysarg_t fs_index, out_copy stream stat);
    77                
     77
    7878                /* Flush file buffers */
    7979                sysarg_t sync(in sysarg_t dev_handle, in sysarg_t fs_index);
    80                
     80
    8181                /* Notify on file close */
    8282                sysarg_t close(in sysarg_t dev_handle, in sysarg_t fs_index);
     
    103103        inst fat fat;
    104104        inst devfs devfs;
    105        
     105
    106106        bind io_dispatcher:tmpfs to tmpfs:tmpfs;
    107107        bind io_dispatcher:fat to fat:fat;
    108108        bind io_dispatcher:devfs to devfs:devfs;
    109        
     109
    110110        bind tmpfs:vfs to io_dispatcher:vfs;
    111111        bind fat:vfs to io_dispatcher:vfs;
    112112        bind devfs:vfs to io_dispatcher:vfs;
    113        
     113
    114114        bind tmpfs:tmpfs_nested to tmpfs:tmpfs;
    115115        bind tmpfs:fat_nested to fat:fat;
    116116        bind tmpfs:devfs_nested to devfs:devfs;
    117        
     117
    118118        bind fat:tmpfs_nested to tmpfs:tmpfs;
    119119        bind fat:fat_nested to fat:fat;
    120120        bind fat:devfs_nested to devfs:devfs;
    121        
     121
    122122        delegate vfs to io_dispatcher:vfs;
    123        
     123
    124124        [/uspace/lib/libc/subsume%io_dispatcher]
    125125        [/uspace/lib/libc/subsume%tmpfs]
    126126        [/uspace/lib/libc/subsume%fat]
    127127        [/uspace/lib/libc/subsume%devfs]
    128        
     128
    129129        subsume io_dispatcher:ns to ns;
    130130        subsume tmpfs:ns to ns;
    131131        subsume fat:ns to ns;
    132132        subsume devfs:ns to ns;
    133        
     133
    134134        subsume tmpfs:rd to rd;
    135135        subsume fat:rd to rd;
    136        
     136
    137137        subsume devfs:devmap_client to devmap_client;
    138138        subsume devfs:device to device;
  • contrib/arch/uspace/srv/vfs/vfs.bp

    r3061bc1 r8565a42  
    99                }
    1010        } +
    11        
     11
    1212        ?mount {
    1313                ?ipc_m_data_write /* mount point */ ;
     
    5151                }
    5252        } +
    53        
     53
    5454        ?open {
    5555                tentative {
     
    6767                }
    6868        } +
    69        
     69
    7070        ?open_node {
    7171                alternative (fs; tmpfs; fat; devfs) {
     
    7878                }
    7979        } +
    80        
     80
    8181        ?close {
    8282                tentative {
     
    8888                }
    8989        } +
    90        
     90
    9191        ?read {
    9292                tentative {
     
    102102                }
    103103        } +
    104        
     104
    105105        ?write {
    106106                tentative {
     
    116116                }
    117117        } +
    118        
     118
    119119        ?truncate {
    120120                tentative {
     
    126126                }
    127127        } +
    128        
     128
    129129        ?fstat {
    130130                tentative {
     
    140140                }
    141141        } +
    142        
     142
    143143        ?stat {
    144144                ?ipc_m_data_write /* path */ ;
     
    156156                }
    157157        } +
    158        
     158
    159159        ?mkdir {
    160160                ?ipc_m_data_write /* path */ ;
     
    165165                }
    166166        } +
    167        
     167
    168168        ?unlink {
    169169                ?ipc_m_data_write /* path */ ;
     
    174174                }
    175175        } +
    176        
     176
    177177        ?rename {
    178178                ?ipc_m_data_write /* old path */ ;
     
    198198                }
    199199        } +
    200        
     200
    201201        ?sync {
    202202                tentative {
     
    206206                }
    207207        } +
    208        
     208
    209209        ?seek
    210        
     210
    211211)* ;
    212212?ipc_m_phone_hungup
Note: See TracChangeset for help on using the changeset viewer.