September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,17 @@
* Duplicate a string
MVC A,=CL64'Hello' a='Hello'
MVC B,A b=a memory copy
MVC A,=CL64'Goodbye' a='Goodbye'
XPRNT A,L'A print a
XPRNT B,L'B print b
...
* Make reference to a string a string
MVC A,=CL64'Hi!' a='Hi!'
LA R1,A r1=@a set pointer
ST R1,REFA refa=@a store pointer
XPRNT A,L'A print a
XPRNT 0(R1),L'A print %refa
...
A DS CL64 a
B DS CL64 b
REFA DS A @a

View file

@ -0,0 +1,4 @@
a$ = "I am here"
b$ = a$
a$ = "Hello world..."
PRINT a$, b$

View file

@ -0,0 +1,5 @@
a$ = "Hello world..."
LOCAL b TYPE STRING
b = a$
a$ = "Goodbye..."
PRINT a$, b

View file

@ -0,0 +1,7 @@
10 A$ = "HELLO"
20 REM COPY CONTENTS OF A$ TO B$
30 B$ = A$
40 REM CHANGE CONTENTS OF A$
50 A$ = "HI"
60 REM DISPLAY CONTENTS
70 PRINT A$, B$

View file

@ -0,0 +1,7 @@
10 LET A$="BECAUSE I DO NOT HOPE TO TURN AGAIN"
20 LET B$=A$
30 LET A$=A$( TO 21)
40 PRINT B$
50 PRINT A$
60 LET B$=A$+B$(22 TO 29)
70 PRINT B$

View file

@ -0,0 +1,3 @@
[a string] # push "a string" on the main stack
d # duplicate the top value
f # show the current contents of the main stack

View file

@ -0,0 +1,63 @@
[ Copy a string
=============
A program for the EDSAC
Copies the source string into storage
tank 6, which is assumed to be free,
and then prints it from there
Works with Initial Orders 2 ]
T56K
GK
[ 0 ] A34@ [ copy the string ]
[ 1 ] T192F
[ 2 ] H34@
C32@
S32@
E17@
T31@
A@
A33@
T@
A1@
A33@
T1@
A2@
A33@
T2@
E@
[ 17 ] O192F [ print the copy ]
[ 18 ] H192F
C32@
S32@
E30@
T31@
A17@
A33@
T17@
A18@
A33@
T18@
E17@
[ 30 ] ZF
[ 31 ] PF
[ 32 ] PD
[ 33 ] P1F
[ 34 ] *F
RF
OF
SF
EF
TF
TF
AF
!F
CF
OF
DF
ED
EZPF

View file

@ -1,3 +1,3 @@
#var src := "Hello".
#var dst := src. // copying the reference
#var copy := src clone. // copying the content
var src := "Hello".
var dst := src. // copying the reference
var copy := src clone. // copying the content

View file

@ -1,4 +1,10 @@
DIM src AS String
DIM dst AS String
Public Sub main()
Dim src As String
Dim dst As String
src = "Hello"
dst = src
Print src
Print dst
End

View file

@ -1,2 +1,3 @@
val h = "Hello"
val c = "" + h
val s = "Hello"
val alias = s // alias === s
val copy = "" + s // copy !== s

View file

@ -0,0 +1,18 @@
/* Rexx ***************************************************************
* 16.05.2013 Walter Pachl
**********************************************************************/
s1 = 'This is a Rexx string'
s2 = s1 /* does not copy the string */
Say 's1='s1
Say 's2='s2
i1=s1~identityhash; Say 's1~identityhash='i1
i2=s2~identityhash; Say 's2~identityhash='i2
s2 = s2~changestr('*', '*') /* creates a modified copy */
Say 's1='s1
Say 's2='s2
i1=s1~identityhash; Say 's1~identityhash='i1
i2=s2~identityhash; Say 's2~identityhash='i2

View file

@ -0,0 +1 @@
"abc".copy() // noop