d3e1ae2e013e14d4fa67dd37104805b6922b36c5
5 /* Каркас для фреймов процедур */
6 public static abstract class FRAME
11 /* Длинна строки LEN(s$) */
12 public static int LEN(byte[] x
)
22 public static String
STRING(byte[] x
)
24 return new String(x
, 0, LEN(x
));
27 public static void COPY(byte[] x
, byte[] v
)
30 int iv
= v
.length
- 1;
33 int len
= (ix
< iv
) ?
(ix
) : (iv
);
42 public static int STRCMP(byte[] a
, byte[] b
)
45 while(a
[i
] != 0 && a
[i
] == b
[i
])
52 public static void HALT(long n
)
57 public static void ASSERT(boolean x
)
62 public static void ASSERT(boolean x
, long n
)
67 public static void TRAP(long n
)
71 throw new RuntimeException("CASE TRAP");
75 throw new RuntimeException("WITH TRAP");
79 throw new RuntimeException("NOT IMPLEMENTED");
83 throw new RuntimeException("RETURN TRAP");
87 throw new RuntimeException("TRAP CODE " + n
);
91 public static int ASH(int x
, int n
)
93 return (n
> 0) ?
(x
<< n
) : (x
>> Math
.abs(n
));
96 public static long ASH(long x
, long n
)
98 return (n
> 0) ?
(x
<< n
) : (x
>> Math
.abs(n
));
101 public static int LSH(int x
, int n
)
103 return (n
> 0) ?
(x
<< n
) : (x
>>> Math
.abs(n
));
106 public static long LSH(long x
, long n
)
108 return (n
> 0) ?
(x
<< n
) : (x
>>> Math
.abs(n
));
111 public static int ROT(int x
, int n
)
115 return (x
<< n
) | (x
>>> (Integer
.SIZE
- n
));
120 return (x
>>> n
) | (x
<< (Integer
.SIZE
- n
));
124 public static long ROT(long x
, long n
)
128 return (x
<< n
) | (x
>>> (Long
.SIZE
- n
));
133 return (x
>>> n
) | (x
<< (Long
.SIZE
- n
));