strnptr_copy error

21 views
Skip to first unread message

Cyrille Duret

unread,
Jan 9, 2015, 10:33:47 PM1/9/15
to ats-lan...@googlegroups.com
hello,
could not understand while this simple sample failed at C compilation level :

#include "share/atspre_staload.hats"


implement main0
() = let
  val s0
= string1_copy("hello world")
  val s1
= strnptr_copy(s0)
  val
() = strnptr_free(s0)
in
  fprintln
! (stdout_ref, strnptr2string(s1))
end


@ patscc -DATS_MEMALLOC_LIBC -o test_strncopy test_strncopy.dats
test_strncopy_dats.c: In function 'mainats_void_0':
test_strncopy_dats.c:331:1: error: 'PMVtmpltcstmat' undeclared (first use in this function)
test_strncopy_dats.c:331:1: note: each undeclared identifier is reported only once for each function it appears in
test_strncopy_dats.c:331:1: error: 'strnptr_copy' undeclared (first use in this function)
test_strncopy_dats.c:331:1: error: expected expression before '>' token

Am I missing something ?

Brandon Barker

unread,
Jan 9, 2015, 11:05:32 PM1/9/15
to ats-lang-users
staload "libats/ML/SATS/string.sats"

gives some improvement

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/1c01641b-d410-4451-a600-e7fa01fde2de%40googlegroups.com.



--
Brandon Barker
brandon...@gmail.com

Brandon Barker

unread,
Jan 9, 2015, 11:15:16 PM1/9/15
to ats-lang-users
I take that back, this is a regression =( It just seemed better at first because of a different change I made.
--
Brandon Barker
brandon...@gmail.com

gmhwxi

unread,
Jan 9, 2015, 11:46:54 PM1/9/15
to ats-lan...@googlegroups.com

I just checked. This function is not implemented in ATS2-0.1.6.
It is really just the same as strptr0_copy:

implement{}
strnptr_copy
  {n}(x) = x2 where
{
  val x = strnptr2ptr(x)
  val x = $UN.castvwtp0{Strptr0}(x)
  val x2 = $UN.castvwtp0{strnptr(n)}(strptr0_copy(x))
  prval ((*void*)) = $UN.cast2void(x)
} (* end of [strnptr_copy] *)

Cyrille Duret

unread,
Jan 10, 2015, 12:14:34 AM1/10/15
to ats-lan...@googlegroups.com
thank you !
Reply all
Reply to author
Forward
0 new messages