Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
9786f69f
Commit
9786f69f
authored
Dec 18, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print(array)
R=r OCL=21570 CL=21570
parent
c9954c63
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
11 deletions
+18
-11
src/cmd/gc/sys.go
src/cmd/gc/sys.go
+1
-0
src/cmd/gc/sysimport.c
src/cmd/gc/sysimport.c
+1
-0
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+5
-0
src/runtime/array.c
src/runtime/array.c
+10
-10
src/runtime/runtime.h
src/runtime/runtime.h
+1
-1
No files found.
src/cmd/gc/sys.go
View file @
9786f69f
...
...
@@ -17,6 +17,7 @@ export func printint(int64);
export
func
printstring
(
string
);
export
func
printpointer
(
*
any
);
export
func
printinter
(
any
);
export
func
printarray
(
any
);
export
func
printnl
();
export
func
printsp
();
...
...
src/cmd/gc/sysimport.c
View file @
9786f69f
...
...
@@ -11,6 +11,7 @@ char *sysimport =
"export func sys.printstring (? string)
\n
"
"export func sys.printpointer (? *any)
\n
"
"export func sys.printinter (? any)
\n
"
"export func sys.printarray (? any)
\n
"
"export func sys.printnl ()
\n
"
"export func sys.printsp ()
\n
"
"export func sys.catstring (? string, ? string) (? string)
\n
"
...
...
src/cmd/gc/walk.c
View file @
9786f69f
...
...
@@ -1936,6 +1936,11 @@ loop:
argtype
(
on
,
l
->
type
->
type
);
// any-1
break
;
}
if
(
isdarray
(
l
->
type
))
{
on
=
syslook
(
"printarray"
,
1
);
argtype
(
on
,
l
->
type
);
// any-1
break
;
}
badtype
(
n
->
op
,
l
->
type
,
T
);
l
=
listnext
(
&
save
);
goto
loop
;
...
...
src/runtime/array.c
View file @
9786f69f
...
...
@@ -30,7 +30,7 @@ sys·newarray(uint32 nel, uint32 cap, uint32 width, Array ret)
prints
(
"; width="
);
sys
·
printint
(
width
);
prints
(
"; ret="
);
sys
·
printarray
(
&
ret
);
sys
·
printarray
(
ret
);
prints
(
"
\n
"
);
}
}
...
...
@@ -56,7 +56,7 @@ sys·arraysliced(Array old, uint32 lb, uint32 hb, uint32 width, Array ret)
if
(
hb
>
old
.
cap
||
lb
>
hb
)
{
if
(
debug
)
{
prints
(
"sys·arraysliced: old="
);
sys
·
printarray
(
&
old
);
sys
·
printarray
(
old
);
prints
(
"; lb="
);
sys
·
printint
(
lb
);
prints
(
"; hb="
);
...
...
@@ -83,7 +83,7 @@ sys·arraysliced(Array old, uint32 lb, uint32 hb, uint32 width, Array ret)
if
(
debug
)
{
prints
(
"sys·arraysliced: old="
);
sys
·
printarray
(
&
old
);
sys
·
printarray
(
old
);
prints
(
"; lb="
);
sys
·
printint
(
lb
);
prints
(
"; hb="
);
...
...
@@ -91,7 +91,7 @@ sys·arraysliced(Array old, uint32 lb, uint32 hb, uint32 width, Array ret)
prints
(
"; width="
);
sys
·
printint
(
width
);
prints
(
"; ret="
);
sys
·
printarray
(
&
ret
);
sys
·
printarray
(
ret
);
prints
(
"
\n
"
);
}
}
...
...
@@ -137,7 +137,7 @@ sys·arrayslices(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Arra
prints
(
"; width="
);
sys
·
printint
(
width
);
prints
(
"; ret="
);
sys
·
printarray
(
&
ret
);
sys
·
printarray
(
ret
);
prints
(
"
\n
"
);
}
}
...
...
@@ -158,18 +158,18 @@ sys·arrays2d(byte* old, uint32 nel, Array ret)
prints
(
"sys·arrays2d: old="
);
sys
·
printpointer
(
old
);
prints
(
"; ret="
);
sys
·
printarray
(
&
ret
);
sys
·
printarray
(
ret
);
prints
(
"
\n
"
);
}
}
void
sys
·
printarray
(
Array
*
a
)
sys
·
printarray
(
Array
a
)
{
prints
(
"["
);
sys
·
printint
(
a
->
nel
);
sys
·
printint
(
a
.
nel
);
prints
(
"/"
);
sys
·
printint
(
a
->
cap
);
sys
·
printint
(
a
.
cap
);
prints
(
"]"
);
sys
·
printpointer
(
a
->
array
);
sys
·
printpointer
(
a
.
array
);
}
src/runtime/runtime.h
View file @
9786f69f
...
...
@@ -350,7 +350,7 @@ void sys·printpc(void*);
void
sys
·
printpointer
(
void
*
);
void
sys
·
printuint
(
uint64
);
void
sys
·
printhex
(
uint64
);
void
sys
·
printarray
(
Array
*
);
void
sys
·
printarray
(
Array
);
void
sys
·
catstring
(
string
,
string
,
string
);
void
sys
·
cmpstring
(
string
,
string
,
int32
);
void
sys
·
slicestring
(
string
,
int32
,
int32
,
string
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment