Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: install.fth | |
4 | \ | |
5 | \ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | \ | |
7 | \ - Do no alter or remove copyright notices | |
8 | \ | |
9 | \ - Redistribution and use of this software in source and binary forms, with | |
10 | \ or without modification, are permitted provided that the following | |
11 | \ conditions are met: | |
12 | \ | |
13 | \ - Redistribution of source code must retain the above copyright notice, | |
14 | \ this list of conditions and the following disclaimer. | |
15 | \ | |
16 | \ - Redistribution in binary form must reproduce the above copyright notice, | |
17 | \ this list of conditions and the following disclaimer in the | |
18 | \ documentation and/or other materials provided with the distribution. | |
19 | \ | |
20 | \ Neither the name of Sun Microsystems, Inc. or the names of contributors | |
21 | \ may be used to endorse or promote products derived from this software | |
22 | \ without specific prior written permission. | |
23 | \ | |
24 | \ This software is provided "AS IS," without a warranty of any kind. | |
25 | \ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
26 | \ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
27 | \ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
28 | \ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
29 | \ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
30 | \ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
31 | \ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
32 | \ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
33 | \ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
34 | \ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
35 | \ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
36 | \ | |
37 | \ You acknowledge that this software is not designed, licensed or | |
38 | \ intended for use in the design, construction, operation or maintenance of | |
39 | \ any nuclear facility. | |
40 | \ | |
41 | \ ========== Copyright Header End ============================================ | |
42 | \ id: @(#)install.fth 1.6 99/02/25 | |
43 | \ purpose: | |
44 | \ copyright: Copyright 1997 Sun Microsystems, Inc. All Rights Reserved | |
45 | ||
46 | headerless | |
47 | \ The default keytable, that deltas are built upon. | |
48 | instance defer base-key-table | |
49 | ||
50 | \ temporary pointer for table building | |
51 | instance variable kbd-char-ptr | |
52 | ||
53 | \ This is the keyboard identify function, return true to continue | |
54 | \ processing. | |
55 | instance defer do-kbd-fn ( addr len -- more? ) | |
56 | ||
57 | \ A buffer that holds the current keyboard table | |
58 | /keytable instance buffer: key-table | |
59 | ||
60 | : nextchar ( -- char ) kbd-char-ptr @ c@ 1 kbd-char-ptr +! ; | |
61 | ||
62 | : ?setkey ( flags adr -- flags' adr' ) | |
63 | over 1 and if nextchar over c! then ( flags adr ) | |
64 | swap u2/ swap keymap-size - ( flags adr ) | |
65 | ; | |
66 | ||
67 | : set-diff-keytable ( difflist-adr -- ) | |
68 | kbd-char-ptr ! ( ) | |
69 | begin ( ) | |
70 | nextchar dup d# 255 <> \ While there are more keys | |
71 | while ( install-flags flag ) | |
72 | nextchar ( install-flags index ) | |
73 | >k-altgmap ( install-flags index' ) | |
74 | key-table + ( install-flags adr ) | |
75 | ?setkey ( install-flags adr ) | |
76 | ?setkey ( install-flags adr ) | |
77 | ?setkey ( install-flags adr ) | |
78 | 2drop | |
79 | repeat | |
80 | drop | |
81 | ; | |
82 | ||
83 | : set-keytable ( table-adr -- ) | |
84 | 1+ \ Skip id byte | |
85 | dup c@ case ( adr selector ) | |
86 | diff-encoding of base-key-table 1+ set-diff-keytable endof ( ) | |
87 | table-encoding of 1+ key-table /keytable cmove endof ( ) | |
88 | alias-encoding of drop endof ( ) | |
89 | ( default: adr selector ) | |
90 | ." Invalid keymap format byte" nip ( selector ) | |
91 | endcase ( ) | |
92 | ; | |
93 | ||
94 | instance variable restart-scan? | |
95 | ||
96 | : next-kbd-addr ( addr-orig addr len -- addr-orig addr len ) | |
97 | restart-scan? @ if ( addr-orig addr len ) | |
98 | 2drop ( addr-orig ) | |
99 | dup dup >kbd-data-size ( addr-orig addr addr' ) | |
100 | dup 1+ c@ swap c@ ( addr-orig addr lo hi ) | |
101 | bwjoin ( addr-orig addr len ) | |
102 | restart-scan? off ( addr-orig addr len ) | |
103 | then ( addr-orig addr len ) | |
104 | ; | |
105 | ||
106 | : .scan-kbds ( addr ) | |
107 | restart-scan? off ( addr-orig ) | |
108 | dup ( addr-orig addr ) | |
109 | true begin ( addr-orig addr more? ) | |
110 | over >kbd-data-size ( addr-orig addr more? addr' ) | |
111 | dup 1+ c@ swap c@ ( addr-orig addr more? lo hi ) | |
112 | bwjoin ( addr-orig addr more? len ) | |
113 | 2dup ( addr-orig addr more? len more? len ) | |
114 | h# ffff <> ( addr-orig addr more? len more? end? ) | |
115 | and while ( addr-orig addr more? len ) | |
116 | nip next-kbd-addr ( addr-orig addr len ) | |
117 | 2dup + ( addr-orig addr len addr' ) | |
118 | -rot do-kbd-fn ( addr-orig addr' more? ) | |
119 | repeat 3drop drop ( -- ) | |
120 | ; | |
121 |