Commit 2987c843 authored by Rob Pike's avatar Rob Pike

arguments available

argc, argv, envc, envv all in sys now
sys.argc() etc.

SVN=124398
parent 87dae02a
......@@ -23,6 +23,11 @@ func intstring(int64) string;
func byteastring(*byte, int32) string;
func mkiface(*byte, *byte, *struct{}) interface{};
func argc() int32;
func envc() int32;
func argv(int32) string;
func envv(int32) string;
func frexp(float64) (int32, float64); // break fp into exp,fract
func ldexp(int32, float64) float64; // make fp from exp,fract
func modf(float64) (float64, float64); // break fp into double.double
......@@ -56,6 +61,13 @@ export
byteastring
mkiface
// args
argc
envc
argv
envv
// fp
frexp
ldexp
modf
......
......@@ -93,54 +93,74 @@ char* sysimport =
"type sys._e041 (sys._e042 sys._o282 sys._i284)\n"
"var !sys.mkiface sys._e041\n"
"type sys._e048 {}\n"
"type sys._o295 {_e292 sys.int32 _e293 sys.float64}\n"
"type sys._i297 {_e294 sys.float64}\n"
"type sys._e047 (sys._e048 sys._o295 sys._i297)\n"
"var !sys.frexp sys._e047\n"
"type sys._e050 {}\n"
"type sys._o304 {_e301 sys.float64}\n"
"type sys._i306 {_e302 sys.int32 _e303 sys.float64}\n"
"type sys._e049 (sys._e050 sys._o304 sys._i306)\n"
"var !sys.ldexp sys._e049\n"
"type sys._e052 {}\n"
"type sys._o314 {_e311 sys.float64 _e312 sys.float64}\n"
"type sys._i316 {_e313 sys.float64}\n"
"type sys._e051 (sys._e052 sys._o314 sys._i316)\n"
"var !sys.modf sys._e051\n"
"type sys._e054 {}\n"
"type sys._e056 [sys.any] sys.any\n"
"type sys._e055 *sys._e056\n"
"type sys._o320 {hmap sys._e055}\n"
"type sys._i322 {keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}\n"
"type sys._e053 (sys._e054 sys._o320 sys._i322)\n"
"var !sys.newmap sys._e053\n"
"type sys._o293 {_e292 sys.int32}\n"
"type sys._e049 {}\n"
"type sys._e047 (sys._e048 sys._o293 sys._e049)\n"
"var !sys.argc sys._e047\n"
"type sys._e051 {}\n"
"type sys._o298 {_e296 sys.string}\n"
"type sys._i300 {_e297 sys.int32}\n"
"type sys._e050 (sys._e051 sys._o298 sys._i300)\n"
"var !sys.argv sys._e050\n"
"type sys._e053 {}\n"
"type sys._o306 {_e304 sys.string}\n"
"type sys._i308 {_e305 sys.int32}\n"
"type sys._e052 (sys._e053 sys._o306 sys._i308)\n"
"var !sys.envv sys._e052\n"
"type sys._e055 {}\n"
"type sys._o313 {_e312 sys.int32}\n"
"type sys._e056 {}\n"
"type sys._e054 (sys._e055 sys._o313 sys._e056)\n"
"var !sys.envc sys._e054\n"
"type sys._e058 {}\n"
"type sys._o330 {val sys.any}\n"
"type sys._e060 [sys.any] sys.any\n"
"type sys._e059 *sys._e060\n"
"type sys._i332 {hmap sys._e059 key sys.any}\n"
"type sys._e057 (sys._e058 sys._o330 sys._i332)\n"
"var !sys.mapaccess1 sys._e057\n"
"type sys._o319 {_e316 sys.int32 _e317 sys.float64}\n"
"type sys._i321 {_e318 sys.float64}\n"
"type sys._e057 (sys._e058 sys._o319 sys._i321)\n"
"var !sys.frexp sys._e057\n"
"type sys._e060 {}\n"
"type sys._o328 {_e325 sys.float64}\n"
"type sys._i330 {_e326 sys.int32 _e327 sys.float64}\n"
"type sys._e059 (sys._e060 sys._o328 sys._i330)\n"
"var !sys.ldexp sys._e059\n"
"type sys._e062 {}\n"
"type sys._o337 {val sys.any pres sys.bool}\n"
"type sys._e064 [sys.any] sys.any\n"
"type sys._e063 *sys._e064\n"
"type sys._i339 {hmap sys._e063 key sys.any}\n"
"type sys._e061 (sys._e062 sys._o337 sys._i339)\n"
"var !sys.mapaccess2 sys._e061\n"
"type sys._e066 {}\n"
"type sys._e067 {}\n"
"type sys._e069 [sys.any] sys.any\n"
"type sys._e068 *sys._e069\n"
"type sys._i344 {hmap sys._e068 key sys.any val sys.any}\n"
"type sys._e065 (sys._e066 sys._e067 sys._i344)\n"
"var !sys.mapassign1 sys._e065\n"
"type sys._e071 {}\n"
"type sys._o338 {_e335 sys.float64 _e336 sys.float64}\n"
"type sys._i340 {_e337 sys.float64}\n"
"type sys._e061 (sys._e062 sys._o338 sys._i340)\n"
"var !sys.modf sys._e061\n"
"type sys._e064 {}\n"
"type sys._e066 [sys.any] sys.any\n"
"type sys._e065 *sys._e066\n"
"type sys._o344 {hmap sys._e065}\n"
"type sys._i346 {keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}\n"
"type sys._e063 (sys._e064 sys._o344 sys._i346)\n"
"var !sys.newmap sys._e063\n"
"type sys._e068 {}\n"
"type sys._o354 {val sys.any}\n"
"type sys._e070 [sys.any] sys.any\n"
"type sys._e069 *sys._e070\n"
"type sys._i356 {hmap sys._e069 key sys.any}\n"
"type sys._e067 (sys._e068 sys._o354 sys._i356)\n"
"var !sys.mapaccess1 sys._e067\n"
"type sys._e072 {}\n"
"type sys._o361 {val sys.any pres sys.bool}\n"
"type sys._e074 [sys.any] sys.any\n"
"type sys._e073 *sys._e074\n"
"type sys._i350 {hmap sys._e073 key sys.any val sys.any pres sys.bool}\n"
"type sys._e070 (sys._e071 sys._e072 sys._i350)\n"
"var !sys.mapassign2 sys._e070\n"
"type sys._i363 {hmap sys._e073 key sys.any}\n"
"type sys._e071 (sys._e072 sys._o361 sys._i363)\n"
"var !sys.mapaccess2 sys._e071\n"
"type sys._e076 {}\n"
"type sys._e077 {}\n"
"type sys._e079 [sys.any] sys.any\n"
"type sys._e078 *sys._e079\n"
"type sys._i368 {hmap sys._e078 key sys.any val sys.any}\n"
"type sys._e075 (sys._e076 sys._e077 sys._i368)\n"
"var !sys.mapassign1 sys._e075\n"
"type sys._e081 {}\n"
"type sys._e082 {}\n"
"type sys._e084 [sys.any] sys.any\n"
"type sys._e083 *sys._e084\n"
"type sys._i374 {hmap sys._e083 key sys.any val sys.any pres sys.bool}\n"
"type sys._e080 (sys._e081 sys._e082 sys._i374)\n"
"var !sys.mapassign2 sys._e080\n"
"))\n"
;
......@@ -24,6 +24,11 @@ loop:
done:
ADDQ $8, CX
SUBQ $16, SP
MOVL DI, 0(SP)
MOVQ SI, 8(SP)
CALL args(SB)
ADDQ $16, SP
CALL check(SB)
CALL main_main(SB)
CALL sys_exit(SB)
......
// $G $F.go && $L $F.$A && ./$A.out arg1 arg2
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
if sys.argc() != 3 {
panic "argc"
}
if sys.argv(1) != "arg1" {
panic "arg1"
}
if sys.argv(2) != "arg2" {
panic "arg2"
}
}
=========== ./args.go
=========== ./char_lit.go
=========== ./float_lit.go
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment