- Timestamp:
- 2018-03-02T20:34:50Z (8 years ago)
- 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)
- Location:
- contrib
- Files:
-
- 28 edited
-
arch/HelenOS.adl (modified) (3 diffs)
-
arch/hadlbppp.py (modified) (109 diffs)
-
arch/kernel/kernel.adl (modified) (11 diffs)
-
arch/uspace/srv/bd/bd.adl (modified) (2 diffs)
-
arch/uspace/srv/console/console.adl (modified) (2 diffs)
-
arch/uspace/srv/console/console.bp (modified) (8 diffs)
-
arch/uspace/srv/devmap/devmap.adl (modified) (2 diffs)
-
arch/uspace/srv/devmap/devmap_client.bp (modified) (1 diff)
-
arch/uspace/srv/devmap/devmap_driver.bp (modified) (1 diff)
-
arch/uspace/srv/fb/fb.adl (modified) (1 diff)
-
arch/uspace/srv/fs/devfs/devfs.bp (modified) (5 diffs)
-
arch/uspace/srv/fs/fat/fat.bp (modified) (3 diffs)
-
arch/uspace/srv/fs/tmpfs/tmpfs.bp (modified) (3 diffs)
-
arch/uspace/srv/kbd/kbd.adl (modified) (1 diff)
-
arch/uspace/srv/loader/loader.adl (modified) (1 diff)
-
arch/uspace/srv/loader/loader.bp (modified) (1 diff)
-
arch/uspace/srv/ns/ns.adl (modified) (1 diff)
-
arch/uspace/srv/ns/ns.bp (modified) (2 diffs)
-
arch/uspace/srv/ns/service.adl (modified) (1 diff)
-
arch/uspace/srv/vfs/vfs.adl (modified) (3 diffs)
-
arch/uspace/srv/vfs/vfs.bp (modified) (14 diffs)
-
highlight/adl.syntax (modified) (3 diffs)
-
highlight/bp.syntax (modified) (1 diff)
-
qemu/build-from-scratch.sh (modified) (1 diff)
-
tools/font/bdf2c.pl (modified) (7 diffs)
-
tools/gen_vga323.c (modified) (1 diff)
-
tools/random_check.sh (modified) (5 diffs)
-
tools/toolchain_check.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
contrib/arch/HelenOS.adl
r3061bc1 r8565a42 2 2 /* SPARTAN kernel */ 3 3 inst kernel kernel; 4 4 5 5 /* Naming Service */ 6 6 inst ns ns; 7 7 8 8 /* Loader (clonable service) */ 9 9 inst loader loader; 10 10 11 11 /* Device mapper */ 12 12 inst devmap devmap; 13 13 14 14 /* Block device */ 15 15 inst bd bd; 16 16 17 17 /* VFS server */ 18 18 inst vfs vfs; 19 19 20 20 /* Console */ 21 21 inst console console; 22 22 23 23 /* Kernel log */ 24 24 inst kio kio; 25 25 26 26 [/uspace/lib/libc/bind%ns] 27 27 [/uspace/lib/libc/bind%loader] … … 31 31 [/uspace/lib/libc/bind%console] 32 32 [/uspace/lib/libc/bind%kio] 33 33 34 34 bind ns:kbd to console:kbd; 35 35 bind ns:fb to console:fb; … … 39 39 bind ns:devmap_client to devmap:devmap_client; 40 40 bind ns:loader to loader:loader; 41 41 42 42 bind loader:ns to ns:ns; 43 43 44 44 bind devmap:ns to ns:ns; 45 45 bind devmap:rd to bd:rd; 46 46 bind devmap:console to console:console; 47 47 48 48 bind bd:ns to ns:ns; 49 49 bind bd:devmap_driver to devmap:devmap_driver; 50 50 51 51 bind vfs:ns to ns:ns; 52 52 bind vfs:rd to bd:rd; 53 53 bind vfs:devmap_client to devmap:devmap_client; 54 54 bind vfs:device to console:console; 55 55 56 56 bind console:ns to ns:ns; 57 57 bind console:devmap_driver to devmap:devmap_driver; 58 58 bind console:sys_console to kernel:sys_console; 59 59 60 60 bind kio:ns to ns:ns; 61 61 }; -
contrib/arch/hadlbppp.py
r3061bc1 r8565a42 41 41 def usage(prname): 42 42 "Print usage syntax" 43 43 44 44 print("%s <--bp|--ebp|--adl|--dot|--nop>+ <OUTPUT>" % prname) 45 45 print() … … 53 53 def tabs(cnt): 54 54 "Return given number of tabs" 55 55 56 56 return ("\t" * cnt) 57 57 58 58 def cond_append(tokens, token, trim): 59 59 "Conditionally append token to tokens with trim" 60 60 61 61 if (trim): 62 62 token = token.strip(" \t") 63 63 64 64 if (token != ""): 65 65 tokens.append(token) 66 66 67 67 return tokens 68 68 69 69 def split_tokens(string, delimiters, trim = False, separate = False): 70 70 "Split string to tokens by delimiters, keep the delimiters" 71 71 72 72 tokens = [] 73 73 last = 0 74 74 i = 0 75 75 76 76 while (i < len(string)): 77 77 for delim in delimiters: 78 78 if (len(delim) > 0): 79 79 80 80 if (string[i:(i + len(delim))] == delim): 81 81 if (separate): … … 86 86 tokens = cond_append(tokens, string[last:i], trim) 87 87 last = i 88 88 89 89 i += len(delim) - 1 90 90 break 91 91 92 92 i += 1 93 93 94 94 tokens = cond_append(tokens, string[last:len(string)], trim) 95 95 96 96 return tokens 97 97 98 98 def identifier(token): 99 99 "Check whether the token is an identifier" 100 100 101 101 if (len(token) == 0): 102 102 return False 103 103 104 104 for i, char in enumerate(token): 105 105 if (i == 0): … … 109 109 if ((not char.isalnum()) and (char != "_")): 110 110 return False 111 111 112 112 return True 113 113 114 114 def descriptor(token): 115 115 "Check whether the token is an interface descriptor" 116 116 117 117 parts = token.split(":") 118 118 if (len(parts) != 2): 119 119 return False 120 120 121 121 return (identifier(parts[0]) and identifier(parts[1])) 122 122 123 123 def word(token): 124 124 "Check whether the token is a word" 125 125 126 126 if (len(token) == 0): 127 127 return False 128 128 129 129 for i, char in enumerate(token): 130 130 if ((not char.isalnum()) and (char != "_") and (char != ".")): 131 131 return False 132 132 133 133 return True 134 134 135 135 def tentative_bp(name, tokens): 136 136 "Preprocess tentative statements in Behavior Protocol" 137 137 138 138 result = [] 139 139 i = 0 140 140 141 141 while (i < len(tokens)): 142 142 if (tokens[i] == "tentative"): … … 145 145 start = i 146 146 level = 1 147 147 148 148 while ((i < len(tokens)) and (level > 0)): 149 149 if (tokens[i] == "{"): … … 151 151 elif (tokens[i] == "}"): 152 152 level -= 1 153 153 154 154 i += 1 155 155 156 156 if (level == 0): 157 157 result.append("(") … … 168 168 else: 169 169 result.append(tokens[i]) 170 170 171 171 i += 1 172 172 173 173 return result 174 174 175 175 def alternative_bp(name, tokens): 176 176 "Preprocess alternative statements in Behavior Protocol" 177 177 178 178 result = [] 179 179 i = 0 180 180 181 181 while (i < len(tokens)): 182 182 if (tokens[i] == "alternative"): … … 184 184 i += 2 185 185 reps = [] 186 186 187 187 while ((i < len(tokens)) and (tokens[i] != ")")): 188 188 reps.append(tokens[i]) … … 191 191 else: 192 192 i += 1 193 193 194 194 if (len(reps) >= 2): 195 195 if ((i + 1 < len(tokens)) and (tokens[i + 1] == "{")): 196 196 i += 2 197 197 198 198 start = i 199 199 level = 1 200 200 201 201 while ((i < len(tokens)) and (level > 0)): 202 202 if (tokens[i] == "{"): … … 204 204 elif (tokens[i] == "}"): 205 205 level -= 1 206 206 207 207 i += 1 208 208 209 209 if (level == 0): 210 210 first = True 211 211 212 212 for rep in reps[1:]: 213 213 retokens = [] … … 218 218 else: 219 219 retokens.append(token) 220 220 221 221 if (first): 222 222 first = False 223 223 else: 224 224 result.append("+") 225 225 226 226 result.append("(") 227 227 result.extend(alternative_bp(name, retokens)) 228 228 result.append(")") 229 229 230 230 if (i < len(tokens)): 231 231 result.append(tokens[i]) … … 240 240 else: 241 241 result.append(tokens[i]) 242 242 243 243 i += 1 244 244 245 245 return result 246 246 247 247 def split_bp(protocol): 248 248 "Convert Behavior Protocol to tokens" 249 249 250 250 return split_tokens(protocol, ["\n", " ", "\t", "(", ")", "{", "}", "*", ";", "+", "||", "|", "!", "?"], True, True) 251 251 252 252 def extend_bp(name, tokens, iface): 253 253 "Convert interface Behavior Protocol to generic protocol" 254 254 255 255 result = [] 256 256 i = 0 257 257 258 258 while (i < len(tokens)): 259 259 result.append(tokens[i]) 260 260 261 261 if (tokens[i] == "?"): 262 262 if (i + 1 < len(tokens)): 263 263 i += 1 264 264 parts = tokens[i].split(".") 265 265 266 266 if (len(parts) == 1): 267 267 result.append("%s.%s" % (iface, tokens[i])) … … 270 270 else: 271 271 print("%s: Unexpected end of protocol" % name) 272 272 273 273 i += 1 274 274 275 275 return result 276 276 277 277 def merge_bp(initialization, finalization, protocols): 278 278 "Merge several Behavior Protocols" 279 279 280 280 indep = [] 281 281 282 282 if (len(protocols) > 1): 283 283 first = True 284 284 285 285 for protocol in protocols: 286 286 if (first): … … 288 288 else: 289 289 indep.append("|") 290 290 291 291 indep.append("(") 292 292 indep.extend(protocol) … … 294 294 elif (len(protocols) == 1): 295 295 indep = protocols[0] 296 296 297 297 inited = [] 298 298 299 299 if (initialization != None): 300 300 if (len(indep) > 0): … … 310 310 else: 311 311 inited = indep 312 312 313 313 finited = [] 314 314 315 315 if (finalization != None): 316 316 if (len(inited) > 0): … … 326 326 else: 327 327 finited = inited 328 328 329 329 return finited 330 330 331 331 def parse_bp(name, tokens, base_indent): 332 332 "Parse Behavior Protocol" 333 333 334 334 tokens = tentative_bp(name, tokens) 335 335 tokens = alternative_bp(name, tokens) 336 336 337 337 indent = base_indent 338 338 output = "" 339 339 340 340 for token in tokens: 341 341 if (token == "\n"): 342 342 continue 343 343 344 344 if ((token == ";") or (token == "+") or (token == "||") or (token == "|")): 345 345 output += " %s" % token … … 350 350 if (indent < base_indent): 351 351 print("%s: Too many parentheses" % name) 352 352 353 353 indent -= 1 354 354 output += "\n%s%s" % (tabs(indent), token) … … 359 359 if (indent < base_indent): 360 360 print("%s: Too many parentheses" % name) 361 361 362 362 indent -= 1 363 363 output += "\n%s%s" % (tabs(indent), token) … … 368 368 else: 369 369 output += "%s" % token 370 370 371 371 if (indent > base_indent): 372 372 print("%s: Missing parentheses" % name) 373 373 374 374 output = output.strip() 375 375 if (output == ""): 376 376 return "NULL" 377 377 378 378 return output 379 379 380 380 def parse_ebp(component, name, tokens, base_indent): 381 381 "Parse Behavior Protocol and generate Extended Behavior Protocol output" 382 382 383 383 return "component %s {\n\tbehavior {\n\t\t%s\n\t}\n}" % (component, parse_bp(name, tokens, base_indent + 2)) 384 384 385 385 def get_iface(name): 386 386 "Get interface by name" 387 387 388 388 global iface_properties 389 389 390 390 if (name in iface_properties): 391 391 return iface_properties[name] 392 392 393 393 return None 394 394 395 395 def inherited_protocols(iface): 396 396 "Get protocols inherited by an interface" 397 397 398 398 result = [] 399 399 400 400 if ('extends' in iface): 401 401 supiface = get_iface(iface['extends']) … … 406 406 else: 407 407 print("%s: Extends unknown interface '%s'" % (iface['name'], iface['extends'])) 408 408 409 409 return result 410 410 411 411 def dump_frame(directed_binds, frame, outdir, var, archf): 412 412 "Dump Behavior Protocol of a given frame" 413 413 414 414 global opt_bp 415 415 global opt_ebp 416 416 417 417 if (opt_ebp): 418 418 fname = "%s.ebp" % frame['name'] 419 419 else: 420 420 fname = "%s.bp" % frame['name'] 421 421 422 422 if (archf != None): 423 423 archf.write("instantiate %s from \"%s\"\n" % (var, fname)) 424 424 425 425 outname = os.path.join(outdir, fname) 426 426 427 427 protocols = [] 428 428 if ('protocol' in frame): 429 429 protocols.append(frame['protocol']) 430 430 431 431 if ('initialization' in frame): 432 432 initialization = frame['initialization'] 433 433 else: 434 434 initialization = None 435 435 436 436 if ('finalization' in frame): 437 437 finalization = frame['finalization'] 438 438 else: 439 439 finalization = None 440 440 441 441 if ('provides' in frame): 442 442 for provides in frame['provides']: … … 448 448 else: 449 449 cnt = 1 450 450 451 451 if ('protocol' in iface): 452 452 proto = extend_bp(outname, iface['protocol'], iface['name']) 453 453 for _ in range(0, cnt): 454 454 protocols.append(proto) 455 455 456 456 for protocol in inherited_protocols(iface): 457 457 proto = extend_bp(outname, protocol, iface['name']) … … 460 460 else: 461 461 print("%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface'])) 462 462 463 463 if (opt_bp): 464 464 outf = open(outname, "w") 465 465 outf.write(parse_bp(outname, merge_bp(initialization, finalization, protocols), 0)) 466 466 outf.close() 467 467 468 468 if (opt_ebp): 469 469 outf = open(outname, "w") … … 473 473 def get_system_arch(): 474 474 "Get system architecture" 475 475 476 476 global arch_properties 477 477 478 478 for arch, properties in arch_properties.items(): 479 479 if ('system' in properties): 480 480 return properties 481 481 482 482 return None 483 483 484 484 def get_arch(name): 485 485 "Get architecture by name" 486 486 487 487 global arch_properties 488 488 489 489 if (name in arch_properties): 490 490 return arch_properties[name] 491 491 492 492 return None 493 493 494 494 def get_frame(name): 495 495 "Get frame by name" 496 496 497 497 global frame_properties 498 498 499 499 if (name in frame_properties): 500 500 return frame_properties[name] 501 501 502 502 return None 503 503 504 504 def create_null_bp(fname, outdir, archf): 505 505 "Create null frame protocol" 506 506 507 507 global opt_bp 508 508 global opt_ebp 509 509 510 510 if (archf != None): 511 511 archf.write("frame \"%s\"\n" % fname) 512 512 513 513 outname = os.path.join(outdir, fname) 514 514 515 515 if (opt_bp): 516 516 outf = open(outname, "w") 517 517 outf.write("NULL") 518 518 outf.close() 519 519 520 520 if (opt_ebp): 521 521 outf = open(outname, "w") … … 525 525 def flatten_binds(binds, delegates, subsumes): 526 526 "Remove bindings which are replaced by delegation or subsumption" 527 527 528 528 result = [] 529 529 stable = True 530 530 531 531 for bind in binds: 532 532 keep = True 533 533 534 534 for delegate in delegates: 535 535 if (bind['to'] == delegate['to']): 536 536 keep = False 537 537 result.append({'from': bind['from'], 'to': delegate['rep']}) 538 538 539 539 for subsume in subsumes: 540 540 if (bind['from'] == subsume['from']): 541 541 keep = False 542 542 result.append({'from': subsume['rep'], 'to': bind['to']}) 543 543 544 544 if (keep): 545 545 result.append(bind) 546 546 else: 547 547 stable = False 548 548 549 549 if (stable): 550 550 return result … … 554 554 def direct_binds(binds): 555 555 "Convert bindings matrix to set of sources by destination" 556 556 557 557 result = {} 558 558 559 559 for bind in binds: 560 560 if (not bind['to'] in result): 561 561 result[bind['to']] = set() 562 562 563 563 result[bind['to']].add(bind['from']) 564 564 565 565 return result 566 566 567 567 def merge_arch(prefix, arch, outdir): 568 568 "Merge subarchitecture into architecture" 569 569 570 570 insts = [] 571 571 binds = [] 572 572 delegates = [] 573 573 subsumes = [] 574 574 575 575 if ('inst' in arch): 576 576 for inst in arch['inst']: … … 588 588 else: 589 589 print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])) 590 590 591 591 if ('bind' in arch): 592 592 for bind in arch['bind']: 593 593 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 595 595 if ('delegate' in arch): 596 596 for delegate in arch['delegate']: 597 597 delegates.append({'to': "%s.%s" % (prefix, delegate['from']), 'rep': "%s_%s.%s" % (prefix, delegate['to'][0], delegate['to'][1])}) 598 598 599 599 if ('subsume' in arch): 600 600 for subsume in arch['subsume']: 601 601 subsumes.append({'from': "%s.%s" % (prefix, subsume['to']), 'rep': "%s_%s.%s" % (prefix, subsume['from'][0], subsume['from'][1])}) 602 602 603 603 return (insts, binds, delegates, subsumes) 604 604 605 605 def dump_archbp(outdir): 606 606 "Dump system architecture Behavior Protocol" 607 607 608 608 global opt_bp 609 609 global opt_ebp 610 610 611 611 arch = get_system_arch() 612 612 613 613 if (arch is None): 614 614 print("Unable to find system architecture") 615 615 return 616 616 617 617 insts = [] 618 618 binds = [] 619 619 delegates = [] 620 620 subsumes = [] 621 621 622 622 if ('inst' in arch): 623 623 for inst in arch['inst']: … … 635 635 else: 636 636 print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])) 637 637 638 638 if ('bind' in arch): 639 639 for bind in arch['bind']: 640 640 binds.append({'from': "%s.%s" % (bind['from'][0], bind['from'][1]), 'to': "%s.%s" % (bind['to'][0], bind['to'][1])}) 641 641 642 642 if ('delegate' in arch): 643 643 for delegate in arch['delegate']: 644 644 print("Unable to delegate interface in system architecture") 645 645 break 646 646 647 647 if ('subsume' in arch): 648 648 for subsume in arch['subsume']: 649 649 print("Unable to subsume interface in system architecture") 650 650 break 651 651 652 652 directed_binds = direct_binds(flatten_binds(binds, delegates, subsumes)) 653 653 654 654 outname = os.path.join(outdir, "%s.archbp" % arch['name']) 655 655 if ((opt_bp) or (opt_ebp)): … … 657 657 else: 658 658 outf = None 659 659 660 660 create_null_bp("null.bp", outdir, outf) 661 661 662 662 for inst in insts: 663 663 dump_frame(directed_binds, inst['frame'], outdir, inst['var'], outf) 664 664 665 665 for dst, src in directed_binds.items(): 666 666 if (outf != None): 667 667 outf.write("bind %s to %s\n" % (", ".join(src), dst)) 668 668 669 669 if (outf != None): 670 670 outf.close() … … 672 672 def preproc_adl(raw, inarg): 673 673 "Preprocess %% statements in ADL" 674 674 675 675 return raw.replace("%%", inarg) 676 676 677 677 def parse_adl(base, root, inname, nested, indent): 678 678 "Parse Architecture Description Language" 679 679 680 680 global output 681 681 global context … … 686 686 global initialization 687 687 global finalization 688 688 689 689 global iface_properties 690 690 global frame_properties 691 691 global arch_properties 692 692 693 693 global arg0 694 694 695 695 if (nested): 696 696 parts = inname.split("%") 697 697 698 698 if (len(parts) > 1): 699 699 inarg = parts[1] 700 700 else: 701 701 inarg = "%%" 702 702 703 703 if (parts[0][0:1] == "/"): 704 704 path = os.path.join(base, ".%s" % parts[0]) … … 707 707 path = os.path.join(root, parts[0]) 708 708 nested_root = root 709 709 710 710 if (not os.path.isfile(path)): 711 711 print("%s: Unable to include file %s" % (inname, path)) … … 715 715 path = inname 716 716 nested_root = root 717 717 718 718 inf = open(path, "r") 719 719 720 720 raw = preproc_adl(inf.read(), inarg) 721 721 tokens = split_tokens(raw, ["\n", " ", "\t", "(", ")", "{", "}", "[", "]", "/*", "*/", "#", ";"], True, True) 722 722 723 723 for token in tokens: 724 724 725 725 # Includes 726 726 727 727 if (INC in context): 728 728 context.remove(INC) … … 730 730 context.add(POST_INC) 731 731 continue 732 732 733 733 if (POST_INC in context): 734 734 if (token != "]"): 735 735 print("%s: Expected ]" % inname) 736 736 737 737 context.remove(POST_INC) 738 738 continue 739 739 740 740 # Comments and newlines 741 741 742 742 if (BLOCK_COMMENT in context): 743 743 if (token == "*/"): 744 744 context.remove(BLOCK_COMMENT) 745 745 746 746 continue 747 747 748 748 if (LINE_COMMENT in context): 749 749 if (token == "\n"): 750 750 context.remove(LINE_COMMENT) 751 751 752 752 continue 753 753 754 754 # Any context 755 755 756 756 if (token == "/*"): 757 757 context.add(BLOCK_COMMENT) 758 758 continue 759 759 760 760 if (token == "#"): 761 761 context.add(LINE_COMMENT) 762 762 continue 763 763 764 764 if (token == "["): 765 765 context.add(INC) 766 766 continue 767 767 768 768 if (token == "\n"): 769 769 continue 770 770 771 771 # "frame" 772 772 773 773 if (FRAME in context): 774 774 if (NULL in context): … … 777 777 else: 778 778 output += "%s\n" % token 779 779 780 780 context.remove(NULL) 781 781 context.remove(FRAME) 782 782 frame = None 783 783 continue 784 784 785 785 if (BODY in context): 786 786 if (FINALIZATION in context): … … 789 789 elif (token == "}"): 790 790 indent -= 1 791 791 792 792 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 793 793 bp = split_bp(finalization) 794 794 finalization = None 795 795 796 796 if (not frame in frame_properties): 797 797 frame_properties[frame] = {} 798 798 799 799 if ('finalization' in frame_properties[frame]): 800 800 print("%s: Finalization protocol for frame '%s' already defined" % (inname, frame)) 801 801 else: 802 802 frame_properties[frame]['finalization'] = bp 803 803 804 804 output += "\n%s" % tabs(2) 805 805 output += parse_bp(inname, bp, 2) 806 806 807 807 context.remove(FINALIZATION) 808 808 if (indent == -1): … … 817 817 finalization += token 818 818 continue 819 819 820 820 if (INITIALIZATION in context): 821 821 if (token == "{"): … … 823 823 elif (token == "}"): 824 824 indent -= 1 825 825 826 826 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 827 827 bp = split_bp(initialization) 828 828 initialization = None 829 829 830 830 if (not frame in frame_properties): 831 831 frame_properties[frame] = {} 832 832 833 833 if ('initialization' in frame_properties[frame]): 834 834 print("%s: Initialization protocol for frame '%s' already defined" % (inname, frame)) 835 835 else: 836 836 frame_properties[frame]['initialization'] = bp 837 837 838 838 output += "\n%s" % tabs(2) 839 839 output += parse_bp(inname, bp, 2) 840 840 841 841 context.remove(INITIALIZATION) 842 842 if (indent == -1): … … 851 851 initialization += token 852 852 continue 853 853 854 854 if (PROTOCOL in context): 855 855 if (token == "{"): … … 857 857 elif (token == "}"): 858 858 indent -= 1 859 859 860 860 if (((token[-1] == ":") and (indent == 0)) or (indent == -1)): 861 861 bp = split_bp(protocol) 862 862 protocol = None 863 863 864 864 if (not frame in frame_properties): 865 865 frame_properties[frame] = {} 866 866 867 867 if ('protocol' in frame_properties[frame]): 868 868 print("%s: Protocol for frame '%s' already defined" % (inname, frame)) 869 869 else: 870 870 frame_properties[frame]['protocol'] = bp 871 871 872 872 output += "\n%s" % tabs(2) 873 873 output += parse_bp(inname, bp, 2) 874 874 875 875 context.remove(PROTOCOL) 876 876 if (indent == -1): … … 885 885 protocol += token 886 886 continue 887 887 888 888 if (REQUIRES in context): 889 889 if (FIN in context): … … 892 892 else: 893 893 output += "%s" % token 894 894 895 895 context.remove(FIN) 896 896 continue 897 897 898 898 if (VAR in context): 899 899 if (not identifier(token)): … … 902 902 if (not frame in frame_properties): 903 903 frame_properties[frame] = {} 904 904 905 905 if (not 'requires' in frame_properties[frame]): 906 906 frame_properties[frame]['requires'] = [] 907 907 908 908 frame_properties[frame]['requires'].append({'iface': arg0, 'var': token}) 909 909 arg0 = None 910 910 911 911 output += "%s" % token 912 912 913 913 context.remove(VAR) 914 914 context.add(FIN) 915 915 continue 916 916 917 917 if ((token == "}") or (token[-1] == ":")): 918 918 context.remove(REQUIRES) … … 923 923 arg0 = token 924 924 output += "\n%s%s " % (tabs(indent), token) 925 925 926 926 context.add(VAR) 927 927 continue 928 928 929 929 if (PROVIDES in context): 930 930 if (FIN in context): … … 933 933 else: 934 934 output += "%s" % token 935 935 936 936 context.remove(FIN) 937 937 continue 938 938 939 939 if (VAR in context): 940 940 if (not identifier(token)): … … 943 943 if (not frame in frame_properties): 944 944 frame_properties[frame] = {} 945 945 946 946 if (not 'provides' in frame_properties[frame]): 947 947 frame_properties[frame]['provides'] = [] 948 948 949 949 frame_properties[frame]['provides'].append({'iface': arg0, 'var': token}) 950 950 arg0 = None 951 951 952 952 output += "%s" % token 953 953 954 954 context.remove(VAR) 955 955 context.add(FIN) 956 956 continue 957 957 958 958 if ((token == "}") or (token[-1] == ":")): 959 959 context.remove(PROVIDES) … … 964 964 arg0 = token 965 965 output += "\n%s%s " % (tabs(indent), token) 966 966 967 967 context.add(VAR) 968 968 continue 969 969 970 970 if (token == "}"): 971 971 if (indent != 2): … … 974 974 indent = 0 975 975 output += "\n%s" % token 976 976 977 977 context.remove(BODY) 978 978 context.add(NULL) 979 979 continue 980 980 981 981 if (token == "provides:"): 982 982 output += "\n%s%s" % (tabs(indent - 1), token) 983 983 context.add(PROVIDES) 984 984 continue 985 985 986 986 if (token == "requires:"): 987 987 output += "\n%s%s" % (tabs(indent - 1), token) 988 988 context.add(REQUIRES) 989 989 continue 990 990 991 991 if (token == "initialization:"): 992 992 output += "\n%s%s" % (tabs(indent - 1), token) … … 995 995 initialization = "" 996 996 continue 997 997 998 998 if (token == "finalization:"): 999 999 output += "\n%s%s" % (tabs(indent - 1), token) … … 1002 1002 finalization = "" 1003 1003 continue 1004 1004 1005 1005 if (token == "protocol:"): 1006 1006 output += "\n%s%s" % (tabs(indent - 1), token) … … 1009 1009 protocol = "" 1010 1010 continue 1011 1011 1012 1012 print("%s: Unknown token '%s' in frame '%s'" % (inname, token, frame)) 1013 1013 continue 1014 1014 1015 1015 if (HEAD in context): 1016 1016 if (token == "{"): … … 1020 1020 context.add(BODY) 1021 1021 continue 1022 1022 1023 1023 if (token == ";"): 1024 1024 output += "%s\n" % token … … 1026 1026 context.remove(FRAME) 1027 1027 continue 1028 1028 1029 1029 print("%s: Unknown token '%s' in frame head '%s'" % (inname, token, frame)) 1030 1030 1031 1031 continue 1032 1032 1033 1033 if (not identifier(token)): 1034 1034 print("%s: Expected frame name" % inname) … … 1036 1036 frame = token 1037 1037 output += "%s " % token 1038 1038 1039 1039 if (not frame in frame_properties): 1040 1040 frame_properties[frame] = {} 1041 1041 1042 1042 frame_properties[frame]['name'] = frame 1043 1043 1044 1044 context.add(HEAD) 1045 1045 continue 1046 1046 1047 1047 # "interface" 1048 1048 1049 1049 if (IFACE in context): 1050 1050 if (NULL in context): … … 1053 1053 else: 1054 1054 output += "%s\n" % token 1055 1055 1056 1056 context.remove(NULL) 1057 1057 context.remove(IFACE) 1058 1058 interface = None 1059 1059 continue 1060 1060 1061 1061 if (BODY in context): 1062 1062 if (PROTOCOL in context): … … 1065 1065 elif (token == "}"): 1066 1066 indent -= 1 1067 1067 1068 1068 if (indent == -1): 1069 1069 bp = split_bp(protocol) 1070 1070 protocol = None 1071 1071 1072 1072 if (not interface in iface_properties): 1073 1073 iface_properties[interface] = {} 1074 1074 1075 1075 if ('protocol' in iface_properties[interface]): 1076 1076 print("%s: Protocol for interface '%s' already defined" % (inname, interface)) 1077 1077 else: 1078 1078 iface_properties[interface]['protocol'] = bp 1079 1079 1080 1080 output += "\n%s" % tabs(2) 1081 1081 output += parse_bp(inname, bp, 2) 1082 1082 output += "\n%s" % token 1083 1083 indent = 0 1084 1084 1085 1085 context.remove(PROTOCOL) 1086 1086 context.remove(BODY) … … 1088 1088 else: 1089 1089 protocol += token 1090 1091 continue 1092 1090 1091 continue 1092 1093 1093 if (PROTOTYPE in context): 1094 1094 if (FIN in context): … … 1097 1097 else: 1098 1098 output += "%s" % token 1099 1099 1100 1100 context.remove(FIN) 1101 1101 context.remove(PROTOTYPE) 1102 1102 continue 1103 1103 1104 1104 if (PAR_RIGHT in context): 1105 1105 if (token == ")"): … … 1109 1109 else: 1110 1110 output += " %s" % token 1111 1112 continue 1113 1111 1112 continue 1113 1114 1114 if (SIGNATURE in context): 1115 1115 output += "%s" % token … … 1117 1117 context.remove(SIGNATURE) 1118 1118 context.add(FIN) 1119 1119 1120 1120 context.remove(SIGNATURE) 1121 1121 context.add(PAR_RIGHT) 1122 1122 continue 1123 1123 1124 1124 if (PAR_LEFT in context): 1125 1125 if (token != "("): … … 1127 1127 else: 1128 1128 output += "%s" % token 1129 1129 1130 1130 context.remove(PAR_LEFT) 1131 1131 context.add(SIGNATURE) 1132 1132 continue 1133 1133 1134 1134 if (not identifier(token)): 1135 1135 print("%s: Method identifier expected in interface '%s'" % (inname, interface)) 1136 1136 else: 1137 1137 output += "%s" % token 1138 1138 1139 1139 context.add(PAR_LEFT) 1140 1140 continue 1141 1141 1142 1142 if (token == "}"): 1143 1143 if (indent != 2): … … 1146 1146 indent = 0 1147 1147 output += "\n%s" % token 1148 1148 1149 1149 context.remove(BODY) 1150 1150 context.add(NULL) 1151 1151 continue 1152 1152 1153 1153 if (token == "sysarg_t"): 1154 1154 output += "\n%s%s " % (tabs(indent), token) 1155 1155 context.add(PROTOTYPE) 1156 1156 continue 1157 1157 1158 1158 if (token == "protocol:"): 1159 1159 output += "\n%s%s" % (tabs(indent - 1), token) … … 1162 1162 protocol = "" 1163 1163 continue 1164 1164 1165 1165 print("%s: Unknown token '%s' in interface '%s'" % (inname, token, interface)) 1166 1166 continue 1167 1167 1168 1168 if (HEAD in context): 1169 1169 if (PRE_BODY in context): … … 1175 1175 context.add(BODY) 1176 1176 continue 1177 1177 1178 1178 if (token == ";"): 1179 1179 output += "%s\n" % token … … 1182 1182 context.remove(IFACE) 1183 1183 continue 1184 1184 1185 1185 print("%s: Expected '{' or ';' in interface head '%s'" % (inname, interface)) 1186 1186 continue 1187 1187 1188 1188 if (EXTENDS in context): 1189 1189 if (not identifier(token)): … … 1193 1193 if (not interface in iface_properties): 1194 1194 iface_properties[interface] = {} 1195 1195 1196 1196 iface_properties[interface]['extends'] = token 1197 1197 1198 1198 context.remove(EXTENDS) 1199 1199 context.add(PRE_BODY) 1200 1200 continue 1201 1201 1202 1202 if (token == "extends"): 1203 1203 output += "%s " % token 1204 1204 context.add(EXTENDS) 1205 1205 continue 1206 1206 1207 1207 if (token == "{"): 1208 1208 output += "%s" % token … … 1211 1211 context.add(BODY) 1212 1212 continue 1213 1213 1214 1214 if (token == ";"): 1215 1215 output += "%s\n" % token … … 1217 1217 context.remove(IFACE) 1218 1218 continue 1219 1219 1220 1220 print("%s: Expected 'extends', '{' or ';' in interface head '%s'" % (inname, interface)) 1221 1221 continue 1222 1222 1223 1223 if (not identifier(token)): 1224 1224 print("%s: Expected interface name" % inname) … … 1226 1226 interface = token 1227 1227 output += "%s " % token 1228 1228 1229 1229 if (not interface in iface_properties): 1230 1230 iface_properties[interface] = {} 1231 1231 1232 1232 iface_properties[interface]['name'] = interface 1233 1233 1234 1234 context.add(HEAD) 1235 1235 continue 1236 1236 1237 1237 # "architecture" 1238 1238 1239 1239 if (ARCH in context): 1240 1240 if (NULL in context): … … 1243 1243 else: 1244 1244 output += "%s\n" % token 1245 1245 1246 1246 context.remove(NULL) 1247 1247 context.remove(ARCH) … … 1249 1249 architecture = None 1250 1250 continue 1251 1251 1252 1252 if (BODY in context): 1253 1253 if (DELEGATE in context): … … 1257 1257 else: 1258 1258 output += "%s" % token 1259 1259 1260 1260 context.remove(FIN) 1261 1261 context.remove(DELEGATE) 1262 1262 continue 1263 1263 1264 1264 if (VAR in context): 1265 1265 if (not descriptor(token)): … … 1268 1268 if (not architecture in arch_properties): 1269 1269 arch_properties[architecture] = {} 1270 1270 1271 1271 if (not 'delegate' in arch_properties[architecture]): 1272 1272 arch_properties[architecture]['delegate'] = [] 1273 1273 1274 1274 arch_properties[architecture]['delegate'].append({'from': arg0, 'to': token.split(":")}) 1275 1275 arg0 = None 1276 1276 1277 1277 output += "%s" % token 1278 1278 1279 1279 context.add(FIN) 1280 1280 context.remove(VAR) 1281 1281 continue 1282 1282 1283 1283 if (TO in context): 1284 1284 if (token != "to"): … … 1286 1286 else: 1287 1287 output += "%s " % token 1288 1288 1289 1289 context.add(VAR) 1290 1290 context.remove(TO) 1291 1291 continue 1292 1292 1293 1293 if (not identifier(token)): 1294 1294 print("%s: Expected interface name in architecture '%s'" % (inname, architecture)) … … 1296 1296 output += "%s " % token 1297 1297 arg0 = token 1298 1298 1299 1299 context.add(TO) 1300 1300 continue 1301 1301 1302 1302 if (SUBSUME in context): 1303 1303 if (FIN in context): … … 1306 1306 else: 1307 1307 output += "%s" % token 1308 1308 1309 1309 context.remove(FIN) 1310 1310 context.remove(SUBSUME) 1311 1311 continue 1312 1312 1313 1313 if (VAR in context): 1314 1314 if (not identifier(token)): … … 1317 1317 if (not architecture in arch_properties): 1318 1318 arch_properties[architecture] = {} 1319 1319 1320 1320 if (not 'subsume' in arch_properties[architecture]): 1321 1321 arch_properties[architecture]['subsume'] = [] 1322 1322 1323 1323 arch_properties[architecture]['subsume'].append({'from': arg0.split(":"), 'to': token}) 1324 1324 arg0 = None 1325 1325 1326 1326 output += "%s" % token 1327 1327 1328 1328 context.add(FIN) 1329 1329 context.remove(VAR) 1330 1330 continue 1331 1331 1332 1332 if (TO in context): 1333 1333 if (token != "to"): … … 1335 1335 else: 1336 1336 output += "%s " % token 1337 1337 1338 1338 context.add(VAR) 1339 1339 context.remove(TO) 1340 1340 continue 1341 1341 1342 1342 if (not descriptor(token)): 1343 1343 print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture)) … … 1345 1345 output += "%s " % token 1346 1346 arg0 = token 1347 1347 1348 1348 context.add(TO) 1349 1349 continue 1350 1350 1351 1351 if (BIND in context): 1352 1352 if (FIN in context): … … 1355 1355 else: 1356 1356 output += "%s" % token 1357 1357 1358 1358 context.remove(FIN) 1359 1359 context.remove(BIND) 1360 1360 continue 1361 1361 1362 1362 if (VAR in context): 1363 1363 if (not descriptor(token)): … … 1366 1366 if (not architecture in arch_properties): 1367 1367 arch_properties[architecture] = {} 1368 1368 1369 1369 if (not 'bind' in arch_properties[architecture]): 1370 1370 arch_properties[architecture]['bind'] = [] 1371 1371 1372 1372 arch_properties[architecture]['bind'].append({'from': arg0.split(":"), 'to': token.split(":")}) 1373 1373 arg0 = None 1374 1374 1375 1375 output += "%s" % token 1376 1376 1377 1377 context.add(FIN) 1378 1378 context.remove(VAR) 1379 1379 continue 1380 1380 1381 1381 if (TO in context): 1382 1382 if (token != "to"): … … 1384 1384 else: 1385 1385 output += "%s " % token 1386 1386 1387 1387 context.add(VAR) 1388 1388 context.remove(TO) 1389 1389 continue 1390 1390 1391 1391 if (not descriptor(token)): 1392 1392 print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture)) … … 1394 1394 output += "%s " % token 1395 1395 arg0 = token 1396 1396 1397 1397 context.add(TO) 1398 1398 continue 1399 1399 1400 1400 if (INST in context): 1401 1401 if (FIN in context): … … 1404 1404 else: 1405 1405 output += "%s" % token 1406 1406 1407 1407 context.remove(FIN) 1408 1408 context.remove(INST) 1409 1409 continue 1410 1410 1411 1411 if (VAR in context): 1412 1412 if (not identifier(token)): … … 1415 1415 if (not architecture in arch_properties): 1416 1416 arch_properties[architecture] = {} 1417 1417 1418 1418 if (not 'inst' in arch_properties[architecture]): 1419 1419 arch_properties[architecture]['inst'] = [] 1420 1420 1421 1421 arch_properties[architecture]['inst'].append({'type': arg0, 'var': token}) 1422 1422 arg0 = None 1423 1423 1424 1424 output += "%s" % token 1425 1425 1426 1426 context.add(FIN) 1427 1427 context.remove(VAR) 1428 1428 continue 1429 1429 1430 1430 if (not identifier(token)): 1431 1431 print("%s: Expected frame/architecture type in architecture '%s'" % (inname, architecture)) … … 1433 1433 output += "%s " % token 1434 1434 arg0 = token 1435 1435 1436 1436 context.add(VAR) 1437 1437 continue 1438 1438 1439 1439 if (token == "}"): 1440 1440 if (indent != 1): … … 1443 1443 indent -= 1 1444 1444 output += "\n%s" % token 1445 1445 1446 1446 context.remove(BODY) 1447 1447 context.add(NULL) 1448 1448 continue 1449 1449 1450 1450 if (token == "inst"): 1451 1451 output += "\n%s%s " % (tabs(indent), token) 1452 1452 context.add(INST) 1453 1453 continue 1454 1454 1455 1455 if (token == "bind"): 1456 1456 output += "\n%s%s " % (tabs(indent), token) 1457 1457 context.add(BIND) 1458 1458 continue 1459 1459 1460 1460 if (token == "subsume"): 1461 1461 output += "\n%s%s " % (tabs(indent), token) 1462 1462 context.add(SUBSUME) 1463 1463 continue 1464 1464 1465 1465 if (token == "delegate"): 1466 1466 output += "\n%s%s " % (tabs(indent), token) 1467 1467 context.add(DELEGATE) 1468 1468 continue 1469 1469 1470 1470 print("%s: Unknown token '%s' in architecture '%s'" % (inname, token, architecture)) 1471 1471 continue 1472 1472 1473 1473 if (HEAD in context): 1474 1474 if (token == "{"): … … 1478 1478 context.add(BODY) 1479 1479 continue 1480 1480 1481 1481 if (token == ";"): 1482 1482 output += "%s\n" % token … … 1485 1485 context.discard(SYSTEM) 1486 1486 continue 1487 1487 1488 1488 if (not word(token)): 1489 1489 print("%s: Expected word in architecture head '%s'" % (inname, architecture)) 1490 1490 else: 1491 1491 output += "%s " % token 1492 1492 1493 1493 continue 1494 1494 1495 1495 if (not identifier(token)): 1496 1496 print("%s: Expected architecture name" % inname) … … 1498 1498 architecture = token 1499 1499 output += "%s " % token 1500 1500 1501 1501 if (not architecture in arch_properties): 1502 1502 arch_properties[architecture] = {} 1503 1503 1504 1504 arch_properties[architecture]['name'] = architecture 1505 1505 1506 1506 if (SYSTEM in context): 1507 1507 arch_properties[architecture]['system'] = True 1508 1508 1509 1509 context.add(HEAD) 1510 1510 continue 1511 1511 1512 1512 # "system architecture" 1513 1513 1514 1514 if (SYSTEM in context): 1515 1515 if (token != "architecture"): … … 1517 1517 else: 1518 1518 output += "%s " % token 1519 1519 1520 1520 context.add(ARCH) 1521 1521 continue 1522 1522 1523 1523 if (token == "frame"): 1524 1524 output += "\n%s " % token 1525 1525 context.add(FRAME) 1526 1526 continue 1527 1527 1528 1528 if (token == "interface"): 1529 1529 output += "\n%s " % token 1530 1530 context.add(IFACE) 1531 1531 continue 1532 1532 1533 1533 if (token == "system"): 1534 1534 output += "\n%s " % token 1535 1535 context.add(SYSTEM) 1536 1536 continue 1537 1537 1538 1538 if (token == "architecture"): 1539 1539 output += "\n%s " % token 1540 1540 context.add(ARCH) 1541 1541 continue 1542 1542 1543 1543 print("%s: Unknown token '%s'" % (inname, token)) 1544 1544 1545 1545 inf.close() 1546 1546 1547 1547 def open_adl(base, root, inname, outdir, outname): 1548 1548 "Open Architecture Description file" 1549 1549 1550 1550 global output 1551 1551 global context … … 1556 1556 global initialization 1557 1557 global finalization 1558 1558 1559 1559 global arg0 1560 1560 1561 1561 global opt_adl 1562 1562 1563 1563 output = "" 1564 1564 context = set() … … 1570 1570 finalization = None 1571 1571 arg0 = None 1572 1572 1573 1573 parse_adl(base, root, inname, False, 0) 1574 1574 output = output.strip() 1575 1575 1576 1576 if ((output != "") and (opt_adl)): 1577 1577 outf = open(outname, "w") … … 1581 1581 def recursion(base, root, output, level): 1582 1582 "Recursive directory walk" 1583 1583 1584 1584 for name in os.listdir(root): 1585 1585 canon = os.path.join(root, name) 1586 1586 1587 1587 if (os.path.isfile(canon)): 1588 1588 fcomp = split_tokens(canon, ["."]) 1589 1589 cname = canon.split("/") 1590 1590 1591 1591 if (fcomp[-1] == ".adl"): 1592 1592 output_path = os.path.join(output, cname[-1]) 1593 1593 open_adl(base, root, canon, output, output_path) 1594 1594 1595 1595 if (os.path.isdir(canon)): 1596 1596 recursion(base, canon, output, level + 1) … … 1598 1598 def merge_dot_frame(prefix, name, frame, outf, indent): 1599 1599 "Dump Dot frame" 1600 1600 1601 1601 outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix)) 1602 1602 outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name)) … … 1605 1605 outf.write("%s\tfillcolor=yellow;\n" % tabs(indent)) 1606 1606 outf.write("%s\t\n" % tabs(indent)) 1607 1607 1608 1608 if ('provides' in frame): 1609 1609 outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, style=filled, color=green, fillcolor=yellow];\n" % (tabs(indent), prefix)) 1610 1610 1611 1611 if ('requires' in frame): 1612 1612 outf.write("%s\t%s__requires [label=\"\", shape=circle, style=filled, color=red, fillcolor=yellow];\n" % (tabs(indent), prefix)) 1613 1613 1614 1614 outf.write("%s}\n" % tabs(indent)) 1615 1615 outf.write("%s\n" % tabs(indent)) … … 1617 1617 def merge_dot_arch(prefix, name, arch, outf, indent): 1618 1618 "Dump Dot subarchitecture" 1619 1619 1620 1620 outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix)) 1621 1621 outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name)) 1622 1622 outf.write("%s\tcolor=red;\n" % tabs(indent)) 1623 1623 outf.write("%s\t\n" % tabs(indent)) 1624 1624 1625 1625 if ('inst' in arch): 1626 1626 for inst in arch['inst']: … … 1634 1634 else: 1635 1635 print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])) 1636 1636 1637 1637 if ('bind' in arch): 1638 1638 labels = {} … … 1642 1642 else: 1643 1643 label = bind['from'][1] 1644 1644 1645 1645 if (not (bind['from'][0], bind['to'][0]) in labels): 1646 1646 labels[(bind['from'][0], bind['to'][0])] = [] 1647 1647 1648 1648 labels[(bind['from'][0], bind['to'][0])].append(label) 1649 1649 1650 1650 for bind in arch['bind']: 1651 1651 if (not (bind['from'][0], bind['to'][0]) in labels): 1652 1652 continue 1653 1653 1654 1654 attrs = [] 1655 1655 1656 1656 if (bind['from'][0] != bind['to'][0]): 1657 1657 attrs.append("ltail=cluster_%s_%s" % (prefix, bind['from'][0])) 1658 1658 attrs.append("lhead=cluster_%s_%s" % (prefix, bind['to'][0])) 1659 1659 1660 1660 attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])])) 1661 1661 del labels[(bind['from'][0], bind['to'][0])] 1662 1662 1663 1663 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 1665 1665 if ('delegate' in arch): 1666 1666 outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, color=green];\n" % (tabs(indent), prefix)) 1667 1667 1668 1668 labels = {} 1669 1669 for delegate in arch['delegate']: … … 1672 1672 else: 1673 1673 label = delegate['from'] 1674 1674 1675 1675 if (not delegate['to'][0] in labels): 1676 1676 labels[delegate['to'][0]] = [] 1677 1677 1678 1678 labels[delegate['to'][0]].append(label) 1679 1679 1680 1680 for delegate in arch['delegate']: 1681 1681 if (not delegate['to'][0] in labels): 1682 1682 continue 1683 1683 1684 1684 attrs = [] 1685 1685 attrs.append("color=gray") … … 1687 1687 attrs.append("label=\"%s\"" % "\\n".join(labels[delegate['to'][0]])) 1688 1688 del labels[delegate['to'][0]] 1689 1689 1690 1690 outf.write("%s\t%s__provides -> %s_%s__provides [%s];\n" % (tabs(indent), prefix, prefix, delegate['to'][0], ", ".join(attrs))) 1691 1691 1692 1692 if ('subsume' in arch): 1693 1693 outf.write("%s\t%s__requires [label=\"\", shape=circle, color=red];\n" % (tabs(indent), prefix)) 1694 1694 1695 1695 labels = {} 1696 1696 for subsume in arch['subsume']: … … 1699 1699 else: 1700 1700 label = subsume['to'] 1701 1701 1702 1702 if (not subsume['from'][0] in labels): 1703 1703 labels[subsume['from'][0]] = [] 1704 1704 1705 1705 labels[subsume['from'][0]].append(label) 1706 1706 1707 1707 for subsume in arch['subsume']: 1708 1708 if (not subsume['from'][0] in labels): 1709 1709 continue 1710 1710 1711 1711 attrs = [] 1712 1712 attrs.append("color=gray") … … 1714 1714 attrs.append("label=\"%s\"" % "\\n".join(labels[subsume['from'][0]])) 1715 1715 del labels[subsume['from'][0]] 1716 1716 1717 1717 outf.write("%s\t%s_%s__requires -> %s__requires [%s];\n" % (tabs(indent), prefix, subsume['from'][0], prefix, ", ".join(attrs))) 1718 1718 1719 1719 outf.write("%s}\n" % tabs(indent)) 1720 1720 outf.write("%s\n" % tabs(indent)) … … 1722 1722 def dump_dot(outdir): 1723 1723 "Dump Dot architecture" 1724 1724 1725 1725 global opt_dot 1726 1726 1727 1727 arch = get_system_arch() 1728 1728 1729 1729 if (arch is None): 1730 1730 print("Unable to find system architecture") 1731 1731 return 1732 1732 1733 1733 if (opt_dot): 1734 1734 outname = os.path.join(outdir, "%s.dot" % arch['name']) 1735 1735 outf = open(outname, "w") 1736 1736 1737 1737 outf.write("digraph {\n") 1738 1738 outf.write("\tlabel=\"%s\";\n" % arch['name']) … … 1741 1741 outf.write("\tedge [fontsize=8];\n") 1742 1742 outf.write("\t\n") 1743 1743 1744 1744 if ('inst' in arch): 1745 1745 for inst in arch['inst']: … … 1753 1753 else: 1754 1754 print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])) 1755 1755 1756 1756 if ('bind' in arch): 1757 1757 labels = {} … … 1761 1761 else: 1762 1762 label = bind['from'][1] 1763 1763 1764 1764 if (not (bind['from'][0], bind['to'][0]) in labels): 1765 1765 labels[(bind['from'][0], bind['to'][0])] = [] 1766 1766 1767 1767 labels[(bind['from'][0], bind['to'][0])].append(label) 1768 1768 1769 1769 for bind in arch['bind']: 1770 1770 if (not (bind['from'][0], bind['to'][0]) in labels): 1771 1771 continue 1772 1772 1773 1773 attrs = [] 1774 1774 1775 1775 if (bind['from'][0] != bind['to'][0]): 1776 1776 attrs.append("ltail=cluster_%s" % bind['from'][0]) 1777 1777 attrs.append("lhead=cluster_%s" % bind['to'][0]) 1778 1778 1779 1779 attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])])) 1780 1780 del labels[(bind['from'][0], bind['to'][0])] 1781 1781 1782 1782 outf.write("\t%s__requires -> %s__provides [%s];\n" % (bind['from'][0], bind['to'][0], ", ".join(attrs))) 1783 1783 1784 1784 if ('delegate' in arch): 1785 1785 for delegate in arch['delegate']: 1786 1786 print("Unable to delegate interface in system architecture") 1787 1787 break 1788 1788 1789 1789 if ('subsume' in arch): 1790 1790 for subsume in arch['subsume']: 1791 1791 print("Unable to subsume interface in system architecture") 1792 1792 break 1793 1793 1794 1794 outf.write("}\n") 1795 1795 1796 1796 outf.close() 1797 1797 … … 1804 1804 global opt_adl 1805 1805 global opt_dot 1806 1806 1807 1807 if (len(sys.argv) < 3): 1808 1808 usage(sys.argv[0]) 1809 1809 return 1810 1810 1811 1811 opt_bp = False 1812 1812 opt_ebp = False 1813 1813 opt_adl = False 1814 1814 opt_dot = False 1815 1815 1816 1816 for arg in sys.argv[1:(len(sys.argv) - 1)]: 1817 1817 if (arg == "--bp"): … … 1828 1828 print("Error: Unknown command line option '%s'" % arg) 1829 1829 return 1830 1830 1831 1831 if ((opt_bp) and (opt_ebp)): 1832 1832 print("Error: Cannot dump both original Behavior Protocols and Extended Behavior Protocols") 1833 1833 return 1834 1834 1835 1835 path = os.path.abspath(sys.argv[-1]) 1836 1836 if (not os.path.isdir(path)): 1837 1837 print("Error: <OUTPUT> is not a directory") 1838 1838 return 1839 1839 1840 1840 iface_properties = {} 1841 1841 frame_properties = {} 1842 1842 arch_properties = {} 1843 1843 1844 1844 recursion(".", ".", path, 0) 1845 1845 dump_archbp(path) -
contrib/arch/kernel/kernel.adl
r3061bc1 r8565a42 13 13 /* Enable kernel console */ 14 14 sysarg_t sys_debug_enable_console(void); 15 15 16 16 /* Disable kernel console */ 17 17 sysarg_t sys_debug_disable_console(void); … … 26 26 /* Create new thread */ 27 27 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 29 29 /* Terminate current thread */ 30 30 sysarg_t sys_thread_exit(int uspace_status); 31 31 32 32 /* Get current thread id */ 33 33 sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id); … … 43 43 /* Set name fo the current task */ 44 44 sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len); 45 45 46 46 /* Get current task id */ 47 47 sysarg_t sys_task_get_id(task_id_t *uspace_task_id); … … 63 63 /* Sleep in a futex wait queue */ 64 64 sysarg_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags); 65 65 66 66 /* Wakeup one thread waiting in futex wait queue */ 67 67 sysarg_t sys_futex_wakeup(uintptr_t uaddr); … … 83 83 /* Create new address space area */ 84 84 sysarg_t sys_as_area_create(uintptr_t address, size_t size, int flags); 85 85 86 86 /* Resize an address space area */ 87 87 sysarg_t sys_as_area_resize(uinptr_t address, size_t size, int flags); 88 88 89 89 /* Change flags of an address space area */ 90 90 sysarg_t sys_as_area_change_flags(uintptr_t address, int flags); 91 91 92 92 /* Destroy an address space area */ 93 93 sysarg_t sys_as_area_destroy(uintptr_t address); … … 104 104 /* Fast synchronous IPC call */ 105 105 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 107 107 /* Slow synchronous IPC call */ 108 108 sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *question, ipc_data_t *answer); 109 109 110 110 /* Fast asynchronous IPC call */ 111 111 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 113 113 /* Slow asynchronous IPC call */ 114 114 sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data); 115 115 116 116 /* Fast forward a received IPC call to another destination */ 117 117 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 119 119 /* Slow forward a received IPC call to another destination */ 120 120 sysarg_t sys_ipc_forward_slow(sysarg_t callid, sysarg_t phoneid, ipc_data_t *data, int mode); 121 121 122 122 /* Fast answer an IPC call */ 123 123 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 125 125 /* Slow answer an IPC call */ 126 126 sysarg_t sys_ipc_answer_slow(sysarg_t callid, ipc_data_t *data); 127 127 128 128 /* Hang up a phone */ 129 129 sysarg_t sys_ipc_hangup(int phoneid); 130 130 131 131 /* Wait for an incoming IPC call or answer */ 132 132 sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, int flags); 133 133 134 134 /* Interrupt one thread of the current task from waiting on IPC call */ 135 135 sysarg_t sys_ipc_poke(void); … … 162 162 sysarg_t sys_cap_grant(sysarg64_t *uspace_taskid, cap_t caps); 163 163 #endif 164 164 165 165 #ifdef __64_BITS__ 166 166 sysarg_t sys_cap_grant(sysarg_t taskid, cap_t caps); 167 167 #endif 168 168 169 169 /* Revoke capabilities from a task */ 170 170 #ifdef __32_BITS__ 171 171 sysarg_t sys_cap_revoke(sysarg64_t *uspace_taskid, cap_t caps); 172 172 #endif 173 173 174 174 #ifdef __64_BITS__ 175 175 sysarg_t sys_cap_revoke(sysarg_t taskid, cap_t caps); … … 185 185 /* Enable access I/O address space for the current task */ 186 186 sysarg_t sys_enable_iospace(ddi_ioarg_t *uspace_io_arg); 187 187 188 188 /* Map physical memory to the current task's address space */ 189 189 sysarg_t sys_physmem_map(sysarg_t phys_base, sysarg_t virt_base, sysarg_t pages, sysarg_t flags); 190 190 191 191 /* Enable or disable preemption */ 192 192 sysarg_t sys_preempt_control(int enable); 193 193 194 194 /* Assign unique device number */ 195 195 sysarg_t sys_device_assign_devno(void); 196 196 197 197 /* Connect an IRQ handler to the current task */ 198 198 sysarg_t sys_register_irq(inr_t inr, devno_t devno, sysarg_t method, irq_code_t *ucode); 199 199 200 200 /* Disconnect an IRQ handler from the current task */ 201 201 sysarg_t sys_unregister_irq(inr_t inr, devno_t devno); … … 214 214 /* Check for sysinfo key validity */ 215 215 sysarg_t sys_sysinfo_valid(sysarg_t ptr, sysarg_t len); 216 216 217 217 /* Get sysinfo key value */ 218 218 sysarg_t sys_sysinfo_value(unatice_t ptr, sysarg_t len); … … 229 229 sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid); 230 230 #endif 231 231 232 232 #ifdef __64_BITS__ 233 233 sysarg_t sys_ipc_connect_kbox(sysarg_t taskid); … … 308 308 inst sys_sysinfo sys_sysinfo; 309 309 inst sys_debug sys_debug; 310 310 311 311 delegate sys_kio to sys_console:sys_kio; 312 312 delegate sys_console to sys_console:sys_console; -
contrib/arch/uspace/srv/bd/bd.adl
r3061bc1 r8565a42 2 2 /* Share out data buffer */ 3 3 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 5 5 /* Get block size */ 6 6 sysarg_t get_block_size(out sysarg_t block_size); 7 7 8 8 /* Read blocks via shared data buffer */ 9 9 sysarg_t read_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count); 10 10 11 11 /* Write blocks via shared data buffer */ 12 12 sysarg_t write_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count); … … 17 17 architecture bd { 18 18 inst rd rd; 19 19 20 20 [/uspace/lib/libc/subsume%rd] 21 21 22 22 delegate rd to rd:rd; 23 23 24 24 subsume rd:ns to ns; 25 25 subsume rd:devmap_driver to devmap_driver; -
contrib/arch/uspace/srv/console/console.adl
r3061bc1 r8565a42 2 2 /* Read characters from console */ 3 3 sysarg_t read(out_copy stream data); 4 4 5 5 /* Write characters to console */ 6 6 sysarg_t write(in_copy stream data); 7 7 8 8 /* Get last event from event queue */ 9 9 sysarg_t get_event(out sysarg_t type, out sysarg_t key, out sysarg_t mods, out sysarg_t char); 10 10 11 11 /* Flush output buffer */ 12 12 sysarg_t sync(void); 13 13 14 14 /* Clear console */ 15 15 sysarg_t clear(void); 16 16 17 17 /* Move cursor to given position */ 18 18 sysarg_t goto(in sysarg_t col, in sysarg_t row); 19 19 20 20 /* Get console dimensions (in character cells) */ 21 21 sysarg_t get_size(out sysarg_t cols, in sysarg_t rows); 22 22 23 23 /* Get color capabilities */ 24 24 sysarg_t get_color_cap(void); 25 25 26 26 /* Set abstract text style */ 27 27 sysarg_t set_style(in sysarg_t style); 28 28 29 29 /* Set EGA-based text color */ 30 30 sysarg_t set_color(in sysarg_t fb_color, in sysarg_t bg_color, in sysarg_t attr); 31 31 32 32 /* Set RGB-based text color */ 33 33 sysarg_t set_rgb_color(in sysarg_t fb_color, in sysarg_t bg_color); 34 34 35 35 /* Set cursor visibility */ 36 36 sysarg_t cursor_visibility(in sysarg_t visible); 37 37 38 38 /* Switch to kernel debugging console (if available) */ 39 39 sysarg_t kcon_enable(void); … … 85 85 inst kbd kbd; 86 86 inst fb fb; 87 87 88 88 bind ui_dispatcher:kbd to kbd:kbd; 89 89 bind ui_dispatcher:fb to fb:fb; 90 90 91 91 bind kbd:event to ui_dispatcher:event; 92 92 93 93 delegate console to ui_dispatcher:console; 94 94 delegate kbd to kbd:kbd; 95 95 delegate fb to fb:fb; 96 96 97 97 [/uspace/lib/libc/subsume%ui_dispatcher] 98 98 [/uspace/lib/libc/subsume%kbd] 99 99 [/uspace/lib/libc/subsume%fb] 100 100 101 101 subsume ui_dispatcher:ns to ns; 102 102 subsume ui_dispatcher:devmap_driver to devmap_driver; 103 103 subsume ui_dispatcher:sys_console to sys_console; 104 104 105 105 subsume kbd:ns to ns; 106 106 subsume fb:ns to ns; -
contrib/arch/uspace/srv/console/console.bp
r3061bc1 r8565a42 5 5 [fnc.cons_read] 6 6 } + 7 7 8 8 ?write { 9 9 [fnc.cons_write] 10 10 } + 11 11 12 12 ?sync { 13 13 [fnc.fb_pending_flush] ; … … 17 17 } 18 18 } + 19 19 20 20 ?clear { 21 21 tentative { … … 23 23 } 24 24 } + 25 25 26 26 ?goto { 27 27 tentative { … … 29 29 } 30 30 } + 31 31 32 32 ?set_style { 33 33 [fnc.fb_pending_flush] ; … … 36 36 } 37 37 } + 38 38 39 39 ?set_color { 40 40 [fnc.fb_pending_flush] ; … … 43 43 } 44 44 } + 45 45 46 46 ?set_rgb_color { 47 47 [fnc.fb_pending_flush] ; … … 50 50 } 51 51 } + 52 52 53 53 ?cursor_visibility { 54 54 [fnc.fb_pending_flush] ; … … 57 57 } 58 58 } + 59 59 60 60 ?kcon_enable { 61 61 !sys_console.sys_debug_enable_console 62 62 } + 63 63 64 64 ?get_event + 65 65 ?get_size + -
contrib/arch/uspace/srv/devmap/devmap.adl
r3061bc1 r8565a42 2 2 /* Establish connection (iface is DEVMAP_DRIVER) */ 3 3 sysarg_t ipc_m_connect_me_to(in sysarg_t iface); 4 4 5 5 /* Register as a new driver */ 6 6 sysarg_t driver_register(in_copy string name); 7 7 8 8 /* Unregister all devices and the driver itself */ 9 9 sysarg_t driver_unregister(void); 10 10 11 11 /* Register new device and return handle */ 12 12 sysarg_t device_register(in_copy string name, out sysarg_t handle); 13 13 14 14 /* Unregister device */ 15 15 sysarg_t device_unregister(in sysarg_t handle); 16 16 17 17 /* Resolve device name to handle */ 18 18 sysarg_t device_get_handle(in sysarg_t flags, in_copy string name); 19 19 20 20 /* Get device name for a given handle */ 21 21 sysarg_t device_get_name(in sysarg_t handle); 22 22 23 23 /* Close connection */ 24 24 sysarg_t ipc_m_phone_hungup(void); … … 30 30 /* Establish connection (iface is DEVMAP_CLIENT) or forward to device (iface is DEVMAP_CONNECT_TO_DEVICE) */ 31 31 sysarg_t ipc_m_connect_me_to(in sysarg_t iface, in sysarg_t handle); 32 32 33 33 /* Resolve device name to handle */ 34 34 sysarg_t device_get_handle(in sysarg_t flags, in_copy string name); 35 35 36 36 /* Get device name for a given handle */ 37 37 sysarg_t device_get_name(in sysarg_t handle); 38 38 39 39 /* Clone NULL device */ 40 40 sysarg_t device_null_create(out sysarg_t index); 41 41 42 42 /* Destroy NULL device */ 43 43 sysarg_t device_null_destroy(in sysarg_t index); 44 44 45 45 /* Get number of devices */ 46 46 sysarg_t device_get_count(out sysarg_t count); 47 47 48 48 /* Get an array of (device_name, handle) pairs */ 49 49 sysarg_t device_get_devices(out_copy stream data); 50 50 51 51 /* Close connection */ 52 52 sysarg_t ipc_m_phone_hungup(void); 53 53 protocol: 54 54 [devmap_client.bp] 55 55 56 56 }; 57 57 -
contrib/arch/uspace/srv/devmap/devmap_client.bp
r3061bc1 r8565a42 10 10 ?ipc_m_data_write /* device name */ 11 11 } + 12 12 13 13 ?device_get_name + 14 14 ?device_null_create + 15 15 ?device_null_destroy + 16 16 ?device_get_count + 17 17 18 18 ?device_get_devices { 19 19 ?ipc_m_data_read /* buffer */ -
contrib/arch/uspace/srv/devmap/devmap_driver.bp
r3061bc1 r8565a42 14 14 } 15 15 } + 16 16 17 17 ?device_get_handle { 18 18 ?ipc_m_data_write /* device name */ 19 19 } + 20 20 21 21 ?device_get_name + 22 22 ?device_unregister + -
contrib/arch/uspace/srv/fb/fb.adl
r3061bc1 r8565a42 2 2 /* Get screen resolution */ 3 3 sysarg_t get_resolution(out sysarg_t width, out sysarg_t height); 4 4 5 5 /* Yield screen */ 6 6 sysarg_t screen_yield(void); 7 7 8 8 /* Reclaim screen */ 9 9 sysarg_t screen_reclaim(void); 10 10 11 11 /* Set mouse cursor position on screen */ 12 12 sysarg_t pointer_move(in sysarg_t x, in sysarg_t y); 13 13 14 14 /* Create new viewport */ 15 15 sysarg_t viewport_create(in sysarg_t origin, in sysarg_t dimension); 16 16 17 17 /* Get viewport size in character cells */ 18 18 sysarg_t get_csize(out sysarg_t width, out sysarg_t height); 19 19 20 20 /* Clear viewport character buffer */ 21 21 sysarg_t clear(void); 22 22 23 23 /* Scroll viewport character buffer */ 24 24 sysarg_t scroll(in sysarg_t lines); 25 25 26 26 /* Set active viewport */ 27 27 sysarg_t viewport_switch(in sysarg_t index); 28 28 29 29 /* Delete viewport */ 30 30 sysarg_t viewport_delete(in sysarg_t index); 31 31 32 32 /* Get color capabilities of the screen */ 33 33 sysarg_t get_color_cap(void); 34 34 35 35 /* Set abstract text style */ 36 36 sysarg_t set_style(in sysarg_t style); 37 37 38 38 /* Set EGA-based text color */ 39 39 sysarg_t set_color(in sysarg_t fg_color, in sysarg_t bg_color, in sysarg_t atrr); 40 40 41 41 /* Set RGB-based text color */ 42 42 sysarg_t set_rgb_color(in sysarg_t fg_color, in sysarg_t bg_color); 43 43 44 44 /* Put a character to a given position in viewport character buffer */ 45 45 sysarg_t putchar(in sysarg_t char, in sysarg_t col, in sysarg_t row); 46 46 47 47 /* Set character cursor visibility in viewport */ 48 48 sysarg_t cursor_visibility(in sysarg_t visible); 49 49 50 50 /* Set character cursor position in viewport */ 51 51 sysarg_t cursor_goto(in sysarg_t col, in sysarg_t row); 52 52 53 53 /* Prepare memory sharing of bitmaps */ 54 54 sysarg_t prepare_shm(in sysarg_t as_area_base); 55 55 56 56 /* Share bitmap or text data */ 57 57 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 59 59 /* Drop memory sharing */ 60 60 sysarg_t drop_shm(void); 61 61 62 62 /* Draw PPM data from shared memory to viewport */ 63 63 sysarg_t draw_ppm(in sysarg_t x, in sysarg_t y); 64 64 65 65 /* Put characters from shared memory to viewport */ 66 66 sysarg_t draw_text_data(in sysarg_t x, in sysarg_t y, in sysarg_t width, in sysarg_t height); 67 67 68 68 /* Convert PPM data from shared memory to pixmap */ 69 69 sysarg_t shm2pixmap(void); 70 70 71 71 /* Save viewport contents to a pixmap */ 72 72 sysarg_t vp2pixmap(in sysarg_t vp_index); 73 73 74 74 /* Draw pixmap to viewport */ 75 75 sysarg_t vp_draw_pixmap(in sysarg_t vp_index, in sysarg_t pm_index); 76 76 77 77 /* Discard pixmap */ 78 78 sysarg_t drop_pixmap(in sysarg_t pm_index); 79 79 80 80 /* Create new (empty) animation for a viewport */ 81 81 sysarg_t anim_create(in sysarg_t vp_index); 82 82 83 83 /* Append a pixmap to an animation */ 84 84 sysarg_t anim_addpixmap(in sysarg_t anim_index, in sysarg_t pm_index); 85 85 86 86 /* Change a viewport associated with an animation */ 87 87 sysarg_t anim_chgvp(in sysarg_t anim_index, in sysarg_t vp_index); 88 88 89 89 /* Start animation playback */ 90 90 sysarg_t anim_start(in sysarg_t anim_index); 91 91 92 92 /* Stop animation playback */ 93 93 sysarg_t anim_stop(in sysarg_t anim_index); 94 94 95 95 /* Delete animation */ 96 96 sysarg_t anim_drop(in sysarg_t anim_index); -
contrib/arch/uspace/srv/fs/devfs/devfs.bp
r3061bc1 r8565a42 5 5 ?ipc_m_data_write /* mount options */ 6 6 } + 7 7 8 8 ?lookup { 9 9 tentative { … … 14 14 } 15 15 } + 16 16 17 17 ?open_node { 18 18 tentative { … … 20 20 } 21 21 } + 22 22 23 23 ?read { 24 24 tentative { … … 34 34 } 35 35 } + 36 36 37 37 ?write { 38 38 tentative { … … 44 44 } 45 45 } + 46 46 47 47 ?stat { 48 48 ?ipc_m_data_read /* struct data */ 49 49 } + 50 50 51 51 ?close { 52 52 !device.ipc_m_phone_hungup 53 53 } + 54 54 55 55 ?mount + 56 56 ?truncate + -
contrib/arch/uspace/srv/fs/fat/fat.bp
r3061bc1 r8565a42 10 10 } 11 11 } + 12 12 13 13 ?mount { 14 14 [/uspace/lib/libfs/fnc.libfs_mount] 15 15 } + 16 16 17 17 ?lookup { 18 18 [/uspace/lib/libfs/fnc.libfs_lookup] 19 19 } + 20 20 21 21 ?open_node { 22 22 [/uspace/lib/libfs/fnc.libfs_open_node] 23 23 } + 24 24 25 25 ?read { 26 26 tentative { … … 28 28 } 29 29 } + 30 30 31 31 ?write { 32 32 tentative { … … 34 34 } 35 35 } + 36 36 37 37 ?stat { 38 38 [/uspace/lib/libfs/fnc.libfs_stat] 39 39 } + 40 40 41 41 ?truncate + 42 42 ?close + -
contrib/arch/uspace/srv/fs/tmpfs/tmpfs.bp
r3061bc1 r8565a42 8 8 } 9 9 } + 10 10 11 11 ?mount { 12 12 [/uspace/lib/libfs/fnc.libfs_mount] 13 13 } + 14 14 15 15 ?lookup { 16 16 [/uspace/lib/libfs/fnc.libfs_lookup] 17 17 } + 18 18 19 19 ?open_node { 20 20 [/uspace/lib/libfs/fnc.libfs_open_node] 21 21 } + 22 22 23 23 ?read { 24 24 tentative { … … 26 26 } 27 27 } + 28 28 29 29 ?write { 30 30 tentative { … … 32 32 } 33 33 } + 34 34 35 35 ?stat { 36 36 [/uspace/lib/libfs/fnc.libfs_stat] 37 37 } + 38 38 39 39 ?truncate + 40 40 ?close + -
contrib/arch/uspace/srv/kbd/kbd.adl
r3061bc1 r8565a42 2 2 /* Callback connection */ 3 3 sysarg_t ipc_m_connect_to_me(void); 4 4 5 5 /* Yield hardware */ 6 6 sysarg_t yield(void); 7 7 8 8 /* Reclaim hardware */ 9 9 sysarg_t reclaim(void); -
contrib/arch/uspace/srv/loader/loader.adl
r3061bc1 r8565a42 2 2 /* Set task pathname */ 3 3 sysarg_t set_pathname(in_copy string pathname); 4 4 5 5 /* Set task arguments */ 6 6 sysarg_t set_args(in_copy stream args); 7 7 8 8 /* Set task initial files */ 9 9 sysarg_t set_files(in_copy stream files); 10 10 11 11 /* Get task ID */ 12 12 sysarg_t get_taskid(out_copy stream id); 13 13 14 14 /* Load binary */ 15 15 sysarg_t load(void); 16 16 17 17 /* Run binary */ 18 18 sysarg_t run(void); -
contrib/arch/uspace/srv/loader/loader.bp
r3061bc1 r8565a42 3 3 ?ipc_m_data_read /* task ID */ 4 4 } + 5 5 6 6 ?set_pathname { 7 7 ?ipc_m_data_write /* pathname */ 8 8 } + 9 9 10 10 ?set_args { 11 11 ?ipc_m_data_write /* arguments */ 12 12 } + 13 13 14 14 ?set_files { 15 15 ?ipc_m_data_write /* files */ 16 16 } + 17 17 18 18 ?load 19 19 )* ; -
contrib/arch/uspace/srv/ns/ns.adl
r3061bc1 r8565a42 2 2 /* Register a clonable service or a generic service */ 3 3 sysarg_t ipc_m_connect_to_me(in sysarg_t service); 4 4 5 5 /* Connect to a clonable service or a generic service */ 6 6 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 8 8 /* Share real-time clock page or kio page */ 9 9 sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service); 10 10 11 11 /* For IPC testing purposes */ 12 12 sysarg_t ping(void); 13 13 14 14 /* Wait for task exit and get exit status and return value */ 15 15 sysarg_t task_wait(in sysarg_t id_lower, in sysarg_t id_upper, out sysarg_t status, out sysarg_t retval); 16 16 17 17 /* Introduce a new loader task id in such a way it cannot be spoofed */ 18 18 sysarg_t id_intro(in sysarg_t id_lower, in sysarg_t id_upper); 19 19 20 20 /* Set task return value */ 21 21 sysarg_t retval(in sysarg_t retval); 22 22 23 23 /* Implicit connection close */ 24 24 sysarg_t ipc_m_phone_hungup(void); -
contrib/arch/uspace/srv/ns/ns.bp
r3061bc1 r8565a42 8 8 } 9 9 } + 10 10 11 11 ?ipc_m_connect_me_to { 12 12 tentative { … … 16 16 } 17 17 } + 18 18 19 19 ?ipc_m_share_in + 20 20 ?ping + -
contrib/arch/uspace/srv/ns/service.adl
r3061bc1 r8565a42 3 3 (this call is forwarded from Naming Service or Device Mapper) */ 4 4 sysarg_t ipc_m_connect_me_to(void); 5 5 6 6 /* Close connection */ 7 7 sysarg_t ipc_m_phone_hungup(void); -
contrib/arch/uspace/srv/vfs/vfs.adl
r3061bc1 r8565a42 2 2 /* Register a filesystem driver */ 3 3 sysarg_t register(in_copy string name); 4 4 5 5 /* Mount filesystem */ 6 6 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 8 8 /* Open file */ 9 9 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 11 11 /* Open file using node */ 12 12 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 14 14 /* Read data from file */ 15 15 sysarg_t read(in sysarg_t fd, out_copy stream data); 16 16 17 17 /* Write data to file */ 18 18 sysarg_t write(in sysarg_t fd, in_copy stream data); 19 19 20 20 /* Seek in file */ 21 21 sysarg_t seek(in sysarg_t fd, in sysarg_t offset, in sysarg_t whence); 22 22 23 23 /* Truncate file */ 24 24 sysarg_t truncate(in sysarg_t fd, in sysarg_t size); 25 25 26 26 /* Get file metadata */ 27 27 sysarg_t fstat(in sysarg_t fd, out_copy stream stat); 28 28 29 29 /* Get directory entry metadata */ 30 30 sysarg_t stat(in_copy string path, out_copy stream stat); 31 31 32 32 /* Create directory */ 33 33 sysarg_t mkdir(in sysarg_t mode, in_copy string path); 34 34 35 35 /* Delete directory entry */ 36 36 sysarg_t unlink(in sysarg_t lflag, in_copy string path); 37 37 38 38 /* Rename directory entry */ 39 39 sysarg_t rename(in_copy string old, in_copy string new); 40 40 41 41 /* Flush file buffers */ 42 42 sysarg_t sync(in sysarg_t fd); 43 43 44 44 /* In-protocol status value */ 45 45 sysarg_t ipc_m_ping(void); 46 46 47 47 /* Close connection */ 48 48 sysarg_t ipc_m_phone_hungup(void); … … 54 54 /* Notify filesystem that it was mounted */ 55 55 sysarg_t mounted(in sysarg_t dev_handle, in_copy string opts); 56 56 57 57 /* Mount filesystem */ 58 58 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 60 60 /* Open file by node */ 61 61 sysarg_t open_node(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...); 62 62 63 63 /* Lookup file */ 64 64 sysarg_t lookup(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...); 65 65 66 66 /* Read data from file */ 67 67 sysarg_t read(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, out_copy stream data); 68 68 69 69 /* Write data to file */ 70 70 sysarg_t write(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, in_copy stream data); 71 71 72 72 /* Truncate file */ 73 73 sysarg_t truncate(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t size); 74 74 75 75 /* Get directory entry metadata */ 76 76 sysarg_t stat(in sysarg_t dev_handle, in sysarg_t fs_index, out_copy stream stat); 77 77 78 78 /* Flush file buffers */ 79 79 sysarg_t sync(in sysarg_t dev_handle, in sysarg_t fs_index); 80 80 81 81 /* Notify on file close */ 82 82 sysarg_t close(in sysarg_t dev_handle, in sysarg_t fs_index); … … 103 103 inst fat fat; 104 104 inst devfs devfs; 105 105 106 106 bind io_dispatcher:tmpfs to tmpfs:tmpfs; 107 107 bind io_dispatcher:fat to fat:fat; 108 108 bind io_dispatcher:devfs to devfs:devfs; 109 109 110 110 bind tmpfs:vfs to io_dispatcher:vfs; 111 111 bind fat:vfs to io_dispatcher:vfs; 112 112 bind devfs:vfs to io_dispatcher:vfs; 113 113 114 114 bind tmpfs:tmpfs_nested to tmpfs:tmpfs; 115 115 bind tmpfs:fat_nested to fat:fat; 116 116 bind tmpfs:devfs_nested to devfs:devfs; 117 117 118 118 bind fat:tmpfs_nested to tmpfs:tmpfs; 119 119 bind fat:fat_nested to fat:fat; 120 120 bind fat:devfs_nested to devfs:devfs; 121 121 122 122 delegate vfs to io_dispatcher:vfs; 123 123 124 124 [/uspace/lib/libc/subsume%io_dispatcher] 125 125 [/uspace/lib/libc/subsume%tmpfs] 126 126 [/uspace/lib/libc/subsume%fat] 127 127 [/uspace/lib/libc/subsume%devfs] 128 128 129 129 subsume io_dispatcher:ns to ns; 130 130 subsume tmpfs:ns to ns; 131 131 subsume fat:ns to ns; 132 132 subsume devfs:ns to ns; 133 133 134 134 subsume tmpfs:rd to rd; 135 135 subsume fat:rd to rd; 136 136 137 137 subsume devfs:devmap_client to devmap_client; 138 138 subsume devfs:device to device; -
contrib/arch/uspace/srv/vfs/vfs.bp
r3061bc1 r8565a42 9 9 } 10 10 } + 11 11 12 12 ?mount { 13 13 ?ipc_m_data_write /* mount point */ ; … … 51 51 } 52 52 } + 53 53 54 54 ?open { 55 55 tentative { … … 67 67 } 68 68 } + 69 69 70 70 ?open_node { 71 71 alternative (fs; tmpfs; fat; devfs) { … … 78 78 } 79 79 } + 80 80 81 81 ?close { 82 82 tentative { … … 88 88 } 89 89 } + 90 90 91 91 ?read { 92 92 tentative { … … 102 102 } 103 103 } + 104 104 105 105 ?write { 106 106 tentative { … … 116 116 } 117 117 } + 118 118 119 119 ?truncate { 120 120 tentative { … … 126 126 } 127 127 } + 128 128 129 129 ?fstat { 130 130 tentative { … … 140 140 } 141 141 } + 142 142 143 143 ?stat { 144 144 ?ipc_m_data_write /* path */ ; … … 156 156 } 157 157 } + 158 158 159 159 ?mkdir { 160 160 ?ipc_m_data_write /* path */ ; … … 165 165 } 166 166 } + 167 167 168 168 ?unlink { 169 169 ?ipc_m_data_write /* path */ ; … … 174 174 } 175 175 } + 176 176 177 177 ?rename { 178 178 ?ipc_m_data_write /* old path */ ; … … 198 198 } 199 199 } + 200 200 201 201 ?sync { 202 202 tentative { … … 206 206 } 207 207 } + 208 208 209 209 ?seek 210 210 211 211 )* ; 212 212 ?ipc_m_phone_hungup -
contrib/highlight/adl.syntax
r3061bc1 r8565a42 6 6 keyword whole frame yellow 7 7 keyword whole architecture yellow 8 8 9 9 keyword whole system yellow 10 10 keyword whole extends yellow 11 11 keyword whole version yellow 12 12 13 13 keyword whole inst yellow 14 14 keyword whole bind yellow … … 16 16 keyword whole subsume yellow 17 17 keyword whole delegate yellow 18 18 19 19 keyword whole sysarg_t yellow 20 20 keyword whole string yellow 21 21 keyword whole stream yellow 22 22 keyword whole void yellow 23 23 24 24 keyword whole in yellow 25 25 keyword whole in_copy yellow 26 26 keyword whole out yellow 27 27 keyword whole out_copy yellow 28 28 29 29 keyword whole protocol yellow 30 30 keyword whole initialization yellow … … 32 32 keyword whole provides yellow 33 33 keyword whole requires yellow 34 34 35 35 keyword /\* brown 36 36 keyword \*/ brown 37 37 keyword // brown 38 38 39 39 keyword { brightcyan 40 40 keyword } brightcyan 41 41 42 42 keyword ( brightcyan 43 43 keyword ) brightcyan 44 44 45 45 keyword , brightcyan 46 46 keyword : brightcyan 47 47 keyword ; brightmagenta 48 48 49 49 keyword [ brightblue black 50 50 keyword ] brightblue black -
contrib/highlight/bp.syntax
r3061bc1 r8565a42 6 6 keyword whole tentative yellow 7 7 keyword whole alternative yellow 8 8 9 9 keyword /\* brown 10 10 keyword \*/ brown 11 11 keyword # brown 12 12 13 13 keyword ! brightred 14 14 keyword ? brightgreen 15 15 16 16 keyword ( brightcyan 17 17 keyword ) brightcyan 18 18 19 19 keyword { brightcyan 20 20 keyword } brightcyan 21 21 22 22 keyword \+ brightmagenta 23 23 keyword ; brightmagenta 24 24 keyword \* brightmagenta 25 25 keyword | brightmagenta 26 26 27 27 keyword \. brightcyan 28 28 29 29 keyword [ brightblue black 30 30 keyword ] brightblue black -
contrib/qemu/build-from-scratch.sh
r3061bc1 r8565a42 90 90 wget ${URL} 91 91 fi 92 92 93 93 if [ "`md5sum ${TARBALL} | cut -f 1 -d " "`" != ${MD5} ]; then 94 94 echo Wrong MD5 checksum 95 95 exit 96 96 fi 97 97 98 98 tar xvfj ${TARBALL} 99 99 cd ${SOURCEDIR} -
contrib/tools/font/bdf2c.pl
r3061bc1 r8565a42 53 53 /^FONTBOUNDINGBOX\s/ and do { 54 54 ($skip, $width, $height, $offset_x, $offset_y) = (split); 55 55 56 56 die("Font width is not 8px\n") if ($width != 8); 57 57 die("Font height is not 16px\n") if ($height != 16); … … 70 70 my @glyph = (); 71 71 my $y; 72 72 73 73 # Add empty lines at top 74 74 my $empties = $height + $offset_y - $goffset_y - $gheight; 75 75 76 76 for ($y = 0; $y < $empties; $y++) { 77 77 $glyph[$y] = 0; 78 78 } 79 79 80 80 # Scan the hex bitmap 81 81 for ($y = $empties; $y < $empties + $gheight; $y++) { … … 83 83 $glyph[$y] = hex(substr($_, 0, 2)) >> $goffset_x; 84 84 } 85 85 86 86 # Add empty lines at bottom 87 87 my $fill = $height - $gheight - $empties; … … 89 89 $glyph[$y] = 0; 90 90 } 91 91 92 92 if ($index != 0) { 93 93 $glyphs[$index] = (\@glyph); … … 125 125 print "\t\treturn (ch - " . ($start - $start_pos) . ");\n"; 126 126 } 127 127 128 128 print "\t\n"; 129 129 } 130 130 131 131 $start = $index; 132 132 $start_pos = $pos; 133 133 } 134 134 135 135 $pos++; 136 136 $prev = $index; … … 145 145 for $index (@chars) { 146 146 print "\n\t{"; 147 147 148 148 my $y; 149 149 for ($y = 0; $y < $height; $y++) { … … 151 151 printf "0x%.2x", $glyphs[$index]->[$y]; 152 152 } 153 153 154 154 print "},"; 155 155 } -
contrib/tools/gen_vga323.c
r3061bc1 r8565a42 36 36 { 37 37 unsigned int i; 38 38 39 39 for (i = 0; i < 256; i++) 40 40 printf("\t.byte 0x%02x, 0x%02x, 0x%02x, 0x00\n", BLUE(i) * 9, GREEN(i) * 21, RED(i) * 9); 41 41 42 42 return 0; 43 43 } -
contrib/tools/random_check.sh
r3061bc1 r8565a42 88 88 COUNTER=$(( $COUNTER + 1 )) 89 89 echo "Try #$COUNTER ($FAILED failed):" >&2 90 90 91 91 ( 92 92 echo " Cleaning after previous build." >&2 93 93 make distclean -j$JOBS 2>&1 || exit 1 94 95 94 95 96 96 echo " Preparing random configuration." >&2 97 97 # It would be nicer to allow set the constraints directly to … … 105 105 exit 2 106 106 fi 107 107 108 108 make random-config 2>&1 || exit 1 109 109 110 110 tr -d ' ' <Makefile.config >"${FILENAME_PREFIX}config.trimmed" 111 111 112 112 THIS_CONFIG_OKAY=true 113 113 while read pattern; do … … 117 117 fi 118 118 done <"$PRUNE_CONFIG_FILE" 119 119 120 120 rm -f "${FILENAME_PREFIX}config.trimmed" 121 121 122 122 if $THIS_CONFIG_OKAY; then 123 123 break 124 124 fi 125 125 done 126 127 126 127 128 128 # Report basic info about the configuration and build it 129 129 BASIC_CONFIG=`sed -n \ … … 134 134 | paste '-sd,' | sed 's#,#, #g'` 135 135 echo -n " Building ($BASIC_CONFIG)... " >&2 136 136 137 137 make -j$JOBS 2>&1 138 138 if [ $? -eq 0 ]; then … … 143 143 exit 1 144 144 fi 145 145 146 146 ) >random_run_$COUNTER.log 147 147 RC=$? 148 148 149 149 if [ $RC -ne 0 ]; then 150 150 tail -n 10 random_run_$COUNTER.log | sed 's#.*# | &#' 151 151 FAILED=$(( $FAILED + 1 )) 152 152 fi 153 153 154 154 if [ -e Makefile.config ]; then 155 155 cp Makefile.config "$FILENAME_PREFIX$COUNTER.Makefile.config" -
contrib/tools/toolchain_check.sh
r3061bc1 r8565a42 38 38 objcopy_path=`echo "$arch_path"/bin/*-objcopy` 39 39 gdb_path=`echo "$arch_path"/bin/*-gdb` 40 40 41 41 print_version "$ld_path" "Linker not found!" || continue 42 42 43 43 print_version "$objcopy_path" "objcopy not found!" || continue 44 44 45 45 print_version "$gcc_path" "GCC not found!" || continue 46 46 check_define "$gcc_path" "__helenos__" 1 || continue 47 47 check_define "$gcc_path" "helenos_uarch" "$arch" || continue 48 48 49 49 print_version "$gdb_path" "GDB not found!" || continue 50 50 done
Note:
See TracChangeset
for help on using the changeset viewer.
