File: libats_libc_strings.dats

package info (click to toggle)
ats2-lang 0.4.2-4
  • links: PTS
  • area: main
  • in suites:
  • size: 40,524 kB
  • sloc: ansic: 389,898; makefile: 7,138; javascript: 1,852; lisp: 811; sh: 657; php: 573; python: 387; perl: 365
file content (47 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(*
** for testing
** [libats/libc/strings]
*)

(* ****** ****** *)
//
#include
"share/atspre_staload.hats"
//
staload UN = $UNSAFE // aliasing
//
(* ****** ****** *)

staload
UNI = "libats/libc/SATS/unistd.sats"

(* ****** ****** *)

staload "libats/libc/SATS/strings.sats"
staload _ = "libats/libc/DATS/strings.dats"

(* ****** ****** *)

val () = {
  val str = "abcde"
  val str2 = "ABCDE"
  val () = assertloc (strcasecmp (str, str2) = 0)
} (* end of [val] *)

(* ****** ****** *)

val () =
{
  val str = "abcde"
  val p0 = string2ptr(str)
  val () = assertloc (strlen (str) = $UN.cast2size(index (str, 0) - p0))
  val () = assertloc (strlen (str) = $UN.cast2size(rindex (str, 0) - p0))
}

(* ****** ****** *)

implement main0 () = ()

(* ****** ****** *)

(* end of [libats_libc_strings.dats] *)