MAC vendor lookup: Difference between revisions

m
m (→‎{{header|Wren}}: Minor tidy)
 
(2 intermediate revisions by one other user not shown)
Line 187:
<pre>Hon Hai Precision Ind. Co.,Ltd.</pre>
 
=={{header|BBCBASICBBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<syntaxhighlight lang="bbcbasic"> DIM Block% 599 : REM Memory buffer to receive GET info
INSTALL @lib$ + "SOCKLIB" : PROC_initsockets
 
READ Mac$
WHILE Mac$ > ""
Line 212 ⟶ 213:
READ Mac$
ENDWHILE
 
PROC_exitsockets
END
 
DATA 88:53:2E:67:07:BE, FC:FB:FB:01:FA:21, D4:F4:6F:C9:EF:8D, 10-11-22-33-44-55,</syntaxhighlight>
{{out}}
 
Line 1,599 ⟶ 1,600:
 
However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to do it for us.
<syntaxhighlight lang="ecmascriptwren">/* mac_vendor_lookupMAC_vendor_lookup.wren */
class MAC {
foreign static lookup(address)
Line 1,610 ⟶ 1,611:
which we embed in the following Go program and run it.
{{libheader|WrenGo}}
<syntaxhighlight lang="go">/* mac_vendor_lookupMAC_vendor_lookup.go */
package main
 
Line 1,640 ⟶ 1,641:
func main() {
vm := wren.NewVM()
fileName := "mac_vendor_lookupMAC_vendor_lookup.wren"
methodMap := wren.MethodMap{"static lookup(_)": macLookup}
classMap := wren.ClassMap{"MAC": wren.NewClass(nil, nil, methodMap)}
9,476

edits