1
0
mirror of https://github.com/golang/go synced 2024-10-04 10:21:21 -06:00
Commit Graph

1029 Commits

Author SHA1 Message Date
Rob Pike
2d4f7ba0cd printf as we know and love it.
Plus print[ln] with the ability to print struct values.

Note for language mavens: if a "..." function passes its argument
to another "..." function, the argument is not wrapped again.  This
allows printf to call fprintf without extra manipulation. It's good
but needs to go in the spec.

This code works:
///
package main

import fmt "fmt"
import os "os"

type T struct { s string; a, b int }

func main() {
	P := fmt.Printer();
	P.printf("%s = %d with float value %.4f\n", "hi there", 7, 123.456);
	P.println("hi there", 7, 123.456);
	P.fprintf(os.Stdout, "%s = %d with float value %.4f\n", "hi there", 7, 123.456);
	P.println(T{"x", 7, 234}, "end of struct", 8, 9);
}

R=rsc
DELTA=28  (7 added, 3 deleted, 18 changed)
OCL=18321
CL=18324
2008-11-02 12:33:02 -08:00
Rob Pike
178e37e766 add creator for missing types, to avoid crashes when
signature is absent from object file.

R=rsc
DELTA=18  (18 added, 0 deleted, 0 changed)
OCL=18315
CL=18323
2008-11-02 12:32:14 -08:00
Ken Thompson
d2472eb812 >>= and <<= shift bug
R=r
OCL=18322
CL=18322
2008-11-01 17:53:12 -07:00
Ken Thompson
2fef4c7198 DOTDOTDOT import/export
R=r
OCL=18319
CL=18319
2008-11-01 16:52:12 -07:00
Rob Pike
59f029cbf2 a couple of bugs in print.
1) bool wasn't handled (added '%t' for 'truth').
2) float64 had a typo.

TBR=rsc
DELTA=11  (10 added, 0 deleted, 1 changed)
OCL=18314
CL=18318
2008-11-01 16:37:53 -07:00
Ken Thompson
74427c6346 DOTDOTDOT
R=r
OCL=18317
CL=18317
2008-11-01 16:36:46 -07:00
Ken Thompson
6fff0efdd8 sprint changed to snprint
R=r
OCL=18316
CL=18316
2008-11-01 15:56:06 -07:00
Robert Griesemer
db27d309d1 - gcd, exponentiation, population count
- more rational numbers stuff
- more tests

R=r
OCL=18295
CL=18295
2008-10-31 16:58:56 -07:00
Ian Lance Taylor
16fd356679 Add support for the basic type "bool".
R=r
DELTA=51  (51 added, 0 deleted, 0 changed)
OCL=18283
CL=18290
2008-10-31 16:34:47 -07:00
Rob Pike
613a5c8bc6 \x00 for NUL in type string.
R=rsc
DELTA=14  (9 added, 0 deleted, 5 changed)
OCL=18281
CL=18281
2008-10-31 15:26:14 -07:00
Russ Cox
8a1ad75644 make %Z handle embedded NULs; remove fixed-size buffer
R=r
DELTA=44  (2 added, 15 deleted, 27 changed)
OCL=18270
CL=18273
2008-10-31 14:57:57 -07:00
Ian Lance Taylor
2eb17d7894 Recognize gccgo error message:
interface1.go:29:6: error: incompatible type in initialization (missing method Next)

R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=18183
CL=18271
2008-10-31 14:55:57 -07:00
Robert Griesemer
42ae5270d8 - handle field tags in pretty printer
R=r
OCL=18264
CL=18264
2008-10-31 14:27:34 -07:00
Robert Griesemer
00dc6e9678 - fixed another test (arithmetic vs. logic shift bug)
R=r
OCL=18235
CL=18237
2008-10-31 10:52:59 -07:00
Rob Pike
15fa1e4033 add mention of tag string to grammar comment
R=rsc
DELTA=3  (2 added, 0 deleted, 1 changed)
OCL=18232
CL=18232
2008-10-31 09:59:29 -07:00
Robert Griesemer
afad827255 - div and mod (arbitrary precision)
- more tests
- some global renames

R=r
OCL=18219
CL=18219
2008-10-30 23:37:34 -07:00
Rob Pike
12a3435869 reflection support for tag strings
R=rsc
DELTA=86  (77 added, 0 deleted, 9 changed)
OCL=18201
CL=18203
2008-10-30 17:29:53 -07:00
Russ Cox
57804f1d2d escape \ in %Z
R=ken
OCL=18202
CL=18202
2008-10-30 17:28:33 -07:00
Russ Cox
4958d41d3b change from $$ to \n$$ for .6 meta section delimiter
R=r
DELTA=13  (5 added, 0 deleted, 8 changed)
OCL=18190
CL=18192
2008-10-30 16:33:50 -07:00
Robert Griesemer
2e90e5424e - language for struct field tags
DELTA=17  (15 added, 0 deleted, 2 changed)
OCL=18177
CL=18184
2008-10-30 15:52:37 -07:00
Russ Cox
dc6bd11ce8 make %Z escape "
R=ken
OCL=18180
CL=18180
2008-10-30 15:35:56 -07:00
Russ Cox
f2b1536328 annotations on embedded types
R=ken
OCL=18179
CL=18179
2008-10-30 15:29:55 -07:00
Russ Cox
1850b29da6 struct annotations in imports.
distribute tag across multiple names.

R=ken
OCL=18178
CL=18178
2008-10-30 15:25:26 -07:00
Russ Cox
f27aaf4819 structure field annotation strings
R=ken
OCL=18176
CL=18176
2008-10-30 15:13:09 -07:00
Robert Griesemer
ebf14c625d - clarified section on numeric types: platform-dependent types
are different from platform-independent types (not just aliases),
  except for byte, uint8
- added missing documentation of new(a, len, cap)
- updated todo/issues lists

DELTA=70  (24 added, 21 deleted, 25 changed)
OCL=17920
CL=18174
2008-10-30 14:50:23 -07:00
Ken Thompson
fd922c875d shift bug
R=r
OCL=18166
CL=18166
2008-10-30 14:32:04 -07:00
Rob Pike
c1198b9b87 update tests
R=rsc
DELTA=159  (65 added, 84 deleted, 10 changed)
OCL=18149
CL=18151
2008-10-30 13:26:57 -07:00
Russ Cox
eb5a316fa6 make sure errchk only prints BUG once.
using a variable is not sufficient, because
sometimes bug() is called from a subshell.

R=iant
DELTA=7  (2 added, 1 deleted, 4 changed)
OCL=18092
CL=18145
2008-10-30 12:43:32 -07:00
Robert Griesemer
7112dc1db7 - implemented Shr
- removed shift work-arounds (6g code appears to work now)
- made similar routines more regular in structure
- more tests

R=r
OCL=18102
CL=18102
2008-10-29 22:05:42 -07:00
Ken Thompson
2c050571d8 shift bugs
R=r
OCL=18095
CL=18095
2008-10-29 20:25:34 -07:00
Russ Cox
9639bd0dd7 apply change suggested in CL 16658 review
R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=18091
CL=18094
2008-10-29 19:59:36 -07:00
Russ Cox
cf9e46fec6 bugs from old gri mail
R=gri
OCL=18093
CL=18093
2008-10-29 19:34:47 -07:00
Ken Thompson
2f5a05a859 bug 113
R=r
OCL=18081
CL=18081
2008-10-29 16:55:52 -07:00
Robert Griesemer
276ffd297d - added shl operation, extra tests
- fixed code so it works with any base between 9 and 64
- work-around for 6g shift problems in various places

R=r
OCL=18080
CL=18080
2008-10-29 16:48:53 -07:00
Russ Cox
d0abe4cbb2 ./6.out
R=ken
OCL=18079
CL=18079
2008-10-29 16:41:01 -07:00
Ken Thompson
4fdf3d6247 bug 113
R=r
OCL=18077
CL=18077
2008-10-29 16:38:23 -07:00
Rob Pike
fe79e436b6 update fmt to int/int32 etc split
R=rsc
DELTA=9  (6 added, 0 deleted, 3 changed)
OCL=18072
CL=18075
2008-10-29 16:05:10 -07:00
Ian Lance Taylor
e76e9cfc33 Call the right function for int32 values.
R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=18073
CL=18073
2008-10-29 15:48:34 -07:00
Rob Pike
282493bbf6 update reflection library to int/int32 etc. split
fmt still to come

R=rsc
DELTA=168  (141 added, 19 deleted, 8 changed)
OCL=18064
CL=18071
2008-10-29 15:31:02 -07:00
Russ Cox
c5e7e19604 update linux for int/int32
R=r
DELTA=7  (0 added, 0 deleted, 7 changed)
OCL=18050
CL=18069
2008-10-29 15:23:36 -07:00
Russ Cox
527669e6b1 set -e doesn't apply to ( ) blocks
R=r
DELTA=6  (0 added, 0 deleted, 6 changed)
OCL=18044
CL=18068
2008-10-29 15:23:29 -07:00
Russ Cox
cc5a382802 update Fmt interface: d=int, ud=uint, d32=int32, d64=int64, etc.
R=r
DELTA=202  (60 added, 24 deleted, 118 changed)
OCL=18029
CL=18038
2008-10-29 14:28:19 -07:00
Russ Cox
123bd8f24b more simple test fixes
R=r
OCL=18035
CL=18035
2008-10-29 14:09:48 -07:00
Ken Thompson
9eebfe6c3b types
R=r
OCL=18034
CL=18034
2008-10-29 14:09:32 -07:00
Russ Cox
915e809f86 update golden.out with new type names
R=r
OCL=18033
CL=18033
2008-10-29 14:05:00 -07:00
Russ Cox
9cdb8bd502 minor int/float fixes
R=ken
OCL=18032
CL=18032
2008-10-29 13:58:12 -07:00
Russ Cox
11a978adf5 shift bug in constant evaluator
R=ken
OCL=18031
CL=18031
2008-10-29 13:46:55 -07:00
Ken Thompson
4a3ce5f19e sigt_int
R=r
OCL=18030
CL=18030
2008-10-29 13:40:00 -07:00
Ken Thompson
89f341db23 new(chan)
R=r
OCL=18027
CL=18027
2008-10-29 13:18:21 -07:00
Russ Cox
9d20756dde fix strings bug from CL 18024
R=r
OCL=18026
CL=18026
2008-10-29 13:17:04 -07:00