Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread gmhwxi
Or you could supply a template parameter (bucket(a) in this case) to
arrayptr_freelin:

implmnt{a} dict_delete_lin ( d ) = let
  implmnt array_uninitize$clear (i, x) = 
bucket_delete_recursive(x)
in
  arrayptr_freelin(d.buckets, size_of_int(d.size))
end
On Thursday, December 30, 2021 at 9:00:48 PM UTC-5 gmhwxi wrote:

> Just need to replace bucket(a) with BUCKET(a) as is shown below:
>
>   implmnt array_uninitize$clear (i, x) = 
> bucket_delete_recursive(x)
>
> On Thursday, December 30, 2021 at 6:07:31 PM UTC-5 d4v3y_5c0n3s wrote:
>
>> Here are the files, with some of the functions that are never used in the 
>> example removed.
>> The code was compiled with:  *patscc -c -DATS_MEMALLOC_LIBC dict.dats*
>> | | |
>> (*
>> ###  dict.sats  ###
>>
>>
>> *)
>>
>> #include "share/atspre_staload.hats"
>>
>> (*  buckets (aka linked lists)  *)
>> absvtype bucket (a:vt@ype) = ptr
>>
>> fn{a:vt@ype} bucket_new ( string, a ) : bucket(a)
>>
>> fn{a:vt@ype} bucket_map ( !bucket(a) ) : void
>> fn{a:vt@ype} bucket_filter_map ( b: !bucket(a) ) : void
>>
>>
>> fn{a:vt@ype} bucket_item$delete ( x: a ): void
>> fn{a:vt@ype} bucket_item$map ( x:  ): void
>> fn{a:vt@ype} bucket_item$filter ( x: !a ): bool
>> fn{a:vt@ype} bucket_item$to_string ( x: !a ): string
>>
>>
>> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>>
>> fn{a:vt@ype} bucket_print ( b: !bucket(a) ) : void
>>
>> (*  dictionaries  *)
>>
>> sortdef dsz = {s:int | s > 0}
>> absvt@ype dict (a:vt@ype, n:int) = @{size=int,buckets=ptr}
>>
>>
>> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
>> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
>> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
>> fn{a:vt@ype} dict_delete_fun {s:dsz} ( d: dict(a, s), (a) -> void ) : void
>> | | |
>> (*
>> ###  dict.dats  ###
>>
>>
>> *)
>>
>> #include "share/atspre_staload.hats"
>>
>> staload "./dict.sats"
>>
>> fn hash {n:int | n>0}{s:int | s>0}
>> ( s: string(s), size: int(n) ) : [o:int | o >= 0; o < n] int o = let
>> fun hash_num {i:nat | i <= s}
>> ( i: int i, h: int, str_sz: int(s) ) : int =
>> if i < str_sz then let
>> val c_at_i = string_get_at_gint(s, i)
>> in
>> hash_num(i+1, h * 101 + g0int_of_char(c_at_i), 
>> str_sz)
>> end else h
>> in
>> g1int_nmod(abs(g1ofg0(hash_num(0, 0, sz2i(strlen(s), size)
>> end
>>
>> local
>>
>> datavtype BUCKET (a:vt@ype) =
>> | bucket_empty of ()
>> | bucket_filled of (Strptr1, a, BUCKET(a))
>>
>> assume bucket(a:vt@ype) = BUCKET(a)
>> assume dict(a:vt@ype, n:int) = @{
>>   size=int n,
>>   buckets=arrayptr(bucket(a), n)
>> }
>>
>> extern fn{a:vt@ype} bucket_operate ( !bucket(a) ) : void
>>
>>
>> in
>>
>> implement{a} dict_new {s} ( size ) = let
>> val size_st = size_of_int(size)
>> val bucket_arr = arrayptr_make_uninitized(size_st)
>> implmnt array_initize$init (i, x) = x := bucket_empty()
>> val () = arrayptr_initize(bucket_arr, size_st)
>> in
>> @{size=size, buckets=bucket_arr}:dict(a, s)
>> end
>>
>> implmnt{a} dict_delete ( d ) = let
>>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
>> in
>>   dict_delete_lin(d)
>> end
>>
>> implmnt{a} bucket_delete_recursive ( b ) =
>> case+ b of
>> | ~bucket_empty() => ()
>> | ~bucket_filled(str, x, next_bucket) => let
>> val () = strptr_free(str)
>> val () = bucket_item$delete(x)
>> in
>> bucket_delete_recursive(next_bucket)
>> end
>>
>> implmnt{a} dict_delete_lin ( d ) = let
>>   implmnt array_uninitize$clear (i, x) = 
>> bucket_delete_recursive(x)
>> in
>>   arrayptr_freelin(d.buckets, size_of_int(d.size))
>> end
>>
>> implmnt{a} dict_delete_fun ( d, dltr ) = let
>>   implmnt bucket_item$delete ( x ) = dltr(x)
>> in
>>   dict_delete_lin(d)
>> end
>>
>>
>> implmnt{a} bucket_new ( key, item ) = 
>> bucket_filled($UNSAFE.castvwtp0{Strptr1}(key), item, bucket_empty())
>>
>> implmnt{a} bucket_map ( b ) =
>>   case+ b of
>>   | bucket_empty() => ()
>>   | @bucket_filled(_, x, next_bucket) => {
>> val () = bucket_item$map(x)
>> val () = bucket_map(next_bucket)
>> prval () = fold@(b)
>>   }
>>
>> implmnt{a} bucket_filter_map ( b ) =
>>   case+ b of
>>   | bucket_empty() => ()
>>   | @bucket_filled(_, x, next_bucket) =>
>>   if bucket_item$filter(x) then {
>>   val () = bucket_item$map(x)
>>   val () = bucket_filter_map(next_bucket)
>>   prval () = fold@(b)
>>   }
>>   else {
>> val () = bucket_filter_map(next_bucket)
>> prval () = fold@(b)
>>   }
>>
>> implmnt{a} bucket_print ( b ) =
>> case+ b of
>> | bucket_empty() => ()
>>
>> | bucket_filled(str, x, next_bucket) => let
>> val () = print("\(")
>> val () = print(str)
>> val () = print(" : ")
>> val () = print( bucket_item$to_string(x) )
>> val () = print(")")
>> in
>> bucket_print(next_bucket)
>> end
>>
>> end
>>
>> var d = dict_new(7)

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread gmhwxi
Just need to replace bucket(a) with BUCKET(a) as is shown below:

  implmnt array_uninitize$clear (i, x) = 
bucket_delete_recursive(x)

On Thursday, December 30, 2021 at 6:07:31 PM UTC-5 d4v3y_5c0n3s wrote:

> Here are the files, with some of the functions that are never used in the 
> example removed.
> The code was compiled with:  *patscc -c -DATS_MEMALLOC_LIBC dict.dats*
> | | |
> (*
> ###  dict.sats  ###
>
>
> *)
>
> #include "share/atspre_staload.hats"
>
> (*  buckets (aka linked lists)  *)
> absvtype bucket (a:vt@ype) = ptr
>
> fn{a:vt@ype} bucket_new ( string, a ) : bucket(a)
>
> fn{a:vt@ype} bucket_map ( !bucket(a) ) : void
> fn{a:vt@ype} bucket_filter_map ( b: !bucket(a) ) : void
>
>
> fn{a:vt@ype} bucket_item$delete ( x: a ): void
> fn{a:vt@ype} bucket_item$map ( x:  ): void
> fn{a:vt@ype} bucket_item$filter ( x: !a ): bool
> fn{a:vt@ype} bucket_item$to_string ( x: !a ): string
>
>
> fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void
>
> fn{a:vt@ype} bucket_print ( b: !bucket(a) ) : void
>
> (*  dictionaries  *)
>
> sortdef dsz = {s:int | s > 0}
> absvt@ype dict (a:vt@ype, n:int) = @{size=int,buckets=ptr}
>
>
> fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
> fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
> fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
> fn{a:vt@ype} dict_delete_fun {s:dsz} ( d: dict(a, s), (a) -> void ) : void
> | | |
> (*
> ###  dict.dats  ###
>
>
> *)
>
> #include "share/atspre_staload.hats"
>
> staload "./dict.sats"
>
> fn hash {n:int | n>0}{s:int | s>0}
> ( s: string(s), size: int(n) ) : [o:int | o >= 0; o < n] int o = let
> fun hash_num {i:nat | i <= s}
> ( i: int i, h: int, str_sz: int(s) ) : int =
> if i < str_sz then let
> val c_at_i = string_get_at_gint(s, i)
> in
> hash_num(i+1, h * 101 + g0int_of_char(c_at_i), 
> str_sz)
> end else h
> in
> g1int_nmod(abs(g1ofg0(hash_num(0, 0, sz2i(strlen(s), size)
> end
>
> local
>
> datavtype BUCKET (a:vt@ype) =
> | bucket_empty of ()
> | bucket_filled of (Strptr1, a, BUCKET(a))
>
> assume bucket(a:vt@ype) = BUCKET(a)
> assume dict(a:vt@ype, n:int) = @{
>   size=int n,
>   buckets=arrayptr(bucket(a), n)
> }
>
> extern fn{a:vt@ype} bucket_operate ( !bucket(a) ) : void
>
>
> in
>
> implement{a} dict_new {s} ( size ) = let
> val size_st = size_of_int(size)
> val bucket_arr = arrayptr_make_uninitized(size_st)
> implmnt array_initize$init (i, x) = x := bucket_empty()
> val () = arrayptr_initize(bucket_arr, size_st)
> in
> @{size=size, buckets=bucket_arr}:dict(a, s)
> end
>
> implmnt{a} dict_delete ( d ) = let
>   implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
> in
>   dict_delete_lin(d)
> end
>
> implmnt{a} bucket_delete_recursive ( b ) =
> case+ b of
> | ~bucket_empty() => ()
> | ~bucket_filled(str, x, next_bucket) => let
> val () = strptr_free(str)
> val () = bucket_item$delete(x)
> in
> bucket_delete_recursive(next_bucket)
> end
>
> implmnt{a} dict_delete_lin ( d ) = let
>   implmnt array_uninitize$clear (i, x) = 
> bucket_delete_recursive(x)
> in
>   arrayptr_freelin(d.buckets, size_of_int(d.size))
> end
>
> implmnt{a} dict_delete_fun ( d, dltr ) = let
>   implmnt bucket_item$delete ( x ) = dltr(x)
> in
>   dict_delete_lin(d)
> end
>
>
> implmnt{a} bucket_new ( key, item ) = 
> bucket_filled($UNSAFE.castvwtp0{Strptr1}(key), item, bucket_empty())
>
> implmnt{a} bucket_map ( b ) =
>   case+ b of
>   | bucket_empty() => ()
>   | @bucket_filled(_, x, next_bucket) => {
> val () = bucket_item$map(x)
> val () = bucket_map(next_bucket)
> prval () = fold@(b)
>   }
>
> implmnt{a} bucket_filter_map ( b ) =
>   case+ b of
>   | bucket_empty() => ()
>   | @bucket_filled(_, x, next_bucket) =>
>   if bucket_item$filter(x) then {
>   val () = bucket_item$map(x)
>   val () = bucket_filter_map(next_bucket)
>   prval () = fold@(b)
>   }
>   else {
> val () = bucket_filter_map(next_bucket)
> prval () = fold@(b)
>   }
>
> implmnt{a} bucket_print ( b ) =
> case+ b of
> | bucket_empty() => ()
>
> | bucket_filled(str, x, next_bucket) => let
> val () = print("\(")
> val () = print(str)
> val () = print(" : ")
> val () = print( bucket_item$to_string(x) )
> val () = print(")")
> in
> bucket_print(next_bucket)
> end
>
> end
>
> var d = dict_new(7)
> val () = dict_delete(d)
> | | |
> On Thursday, December 30, 2021 at 2:48:29 PM UTC-5 gmhwxi wrote:
>
>> Where can I find your source code so that I can produce the error you are 
>> referring to?
>>
>> --Hongwei
>>
>>
>> On Thu, Dec 30, 2021 at 12:47 PM d4v3y_5c0n3s  wrote:
>>
>>> Ok, so I've been able to get the "dict" type to be abstract, but I can't 
>>> seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you 
>>> suggested, but I'm not having any luck.  Using your 

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread d4v3y_5c0n3s
Here are the files, with some of the functions that are never used in the 
example removed.
The code was compiled with:  *patscc -c -DATS_MEMALLOC_LIBC dict.dats*
| | |
(*
###  dict.sats  ###


*)

#include "share/atspre_staload.hats"

(*  buckets (aka linked lists)  *)
absvtype bucket (a:vt@ype) = ptr

fn{a:vt@ype} bucket_new ( string, a ) : bucket(a)

fn{a:vt@ype} bucket_map ( !bucket(a) ) : void
fn{a:vt@ype} bucket_filter_map ( b: !bucket(a) ) : void

fn{a:vt@ype} bucket_item$delete ( x: a ): void
fn{a:vt@ype} bucket_item$map ( x:  ): void
fn{a:vt@ype} bucket_item$filter ( x: !a ): bool
fn{a:vt@ype} bucket_item$to_string ( x: !a ): string

fun{a:vt@ype} bucket_delete_recursive ( b: bucket(a) ) : void

fn{a:vt@ype} bucket_print ( b: !bucket(a) ) : void

(*  dictionaries  *)
sortdef dsz = {s:int | s > 0}
absvt@ype dict (a:vt@ype, n:int) = @{size=int,buckets=ptr}

fn{a:vt@ype} dict_new {s:dsz} ( int s ) : dict(a, s)
fn{a:t@ype} dict_delete {s:dsz} ( d: dict(a, s) ) : void
fn{a:vt@ype} dict_delete_lin {s:dsz} ( d: dict(a, s) ) : void
fn{a:vt@ype} dict_delete_fun {s:dsz} ( d: dict(a, s), (a) -> void ) : void
| | |
(*
###  dict.dats  ###


*)

#include "share/atspre_staload.hats"

staload "./dict.sats"

fn hash {n:int | n>0}{s:int | s>0}
( s: string(s), size: int(n) ) : [o:int | o >= 0; o < n] int o = let
fun hash_num {i:nat | i <= s}
( i: int i, h: int, str_sz: int(s) ) : int =
if i < str_sz then let
val c_at_i = string_get_at_gint(s, i)
in
hash_num(i+1, h * 101 + g0int_of_char(c_at_i), 
str_sz)
end else h
in
g1int_nmod(abs(g1ofg0(hash_num(0, 0, sz2i(strlen(s), size)
end

local
datavtype BUCKET (a:vt@ype) =
| bucket_empty of ()
| bucket_filled of (Strptr1, a, BUCKET(a))

assume bucket(a:vt@ype) = BUCKET(a)
assume dict(a:vt@ype, n:int) = @{
  size=int n,
  buckets=arrayptr(bucket(a), n)
}

extern fn{a:vt@ype} bucket_operate ( !bucket(a) ) : void

in

implement{a} dict_new {s} ( size ) = let
val size_st = size_of_int(size)
val bucket_arr = arrayptr_make_uninitized(size_st)
implmnt array_initize$init (i, x) = x := bucket_empty()
val () = arrayptr_initize(bucket_arr, size_st)
in
@{size=size, buckets=bucket_arr}:dict(a, s)
end

implmnt{a} dict_delete ( d ) = let
  implmnt(a2:t@ype) bucket_item$delete ( x ) = ()
in
  dict_delete_lin(d)
end

implmnt{a} bucket_delete_recursive ( b ) =
case+ b of
| ~bucket_empty() => ()
| ~bucket_filled(str, x, next_bucket) => let
val () = strptr_free(str)
val () = bucket_item$delete(x)
in
bucket_delete_recursive(next_bucket)
end

implmnt{a} dict_delete_lin ( d ) = let
  implmnt array_uninitize$clear (i, x) = 
bucket_delete_recursive(x)
in
  arrayptr_freelin(d.buckets, size_of_int(d.size))
end

implmnt{a} dict_delete_fun ( d, dltr ) = let
  implmnt bucket_item$delete ( x ) = dltr(x)
in
  dict_delete_lin(d)
end


implmnt{a} bucket_new ( key, item ) = 
bucket_filled($UNSAFE.castvwtp0{Strptr1}(key), item, bucket_empty())

implmnt{a} bucket_map ( b ) =
  case+ b of
  | bucket_empty() => ()
  | @bucket_filled(_, x, next_bucket) => {
val () = bucket_item$map(x)
val () = bucket_map(next_bucket)
prval () = fold@(b)
  }

implmnt{a} bucket_filter_map ( b ) =
  case+ b of
  | bucket_empty() => ()
  | @bucket_filled(_, x, next_bucket) =>
  if bucket_item$filter(x) then {
  val () = bucket_item$map(x)
  val () = bucket_filter_map(next_bucket)
  prval () = fold@(b)
  }
  else {
val () = bucket_filter_map(next_bucket)
prval () = fold@(b)
  }

implmnt{a} bucket_print ( b ) =
case+ b of
| bucket_empty() => ()
| bucket_filled(str, x, next_bucket) => let
val () = print("\(")
val () = print(str)
val () = print(" : ")
val () = print( bucket_item$to_string(x) )
val () = print(")")
in
bucket_print(next_bucket)
end

end

var d = dict_new(7)
val () = dict_delete(d)
| | |
On Thursday, December 30, 2021 at 2:48:29 PM UTC-5 gmhwxi wrote:

> Where can I find your source code so that I can produce the error you are 
> referring to?
>
> --Hongwei
>
>
> On Thu, Dec 30, 2021 at 12:47 PM d4v3y_5c0n3s  wrote:
>
>> Ok, so I've been able to get the "dict" type to be abstract, but I can't 
>> seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you 
>> suggested, but I'm not having any luck.  Using your solution, the code will 
>> compile, unless I test the "dict" type by calling "dict_new" & 
>> "dict_delete."  Looking at the error messages, the problem appears to be 
>> related to the "dict_delete" call, and I've provided the error below so you 
>> can see for yourself.  I know that there are a lot of details missing, so 
>> let me know if you'd like me to provide any more details.
>>
>> Error message:
>> In file included from dict_dats.c:15:
>> dict_dats.c: In function ‘loop_95__95__1’:
>> dict_dats.c:6190:28: error: 

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread Hongwei Xi
Where can I find your source code so that I can produce the error you are
referring to?

--Hongwei


On Thu, Dec 30, 2021 at 12:47 PM d4v3y_5c0n3s  wrote:

> Ok, so I've been able to get the "dict" type to be abstract, but I can't
> seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you
> suggested, but I'm not having any luck.  Using your solution, the code will
> compile, unless I test the "dict" type by calling "dict_new" &
> "dict_delete."  Looking at the error messages, the problem appears to be
> related to the "dict_delete" call, and I've provided the error below so you
> can see for yourself.  I know that there are a lot of details missing, so
> let me know if you'd like me to provide any more details.
>
> Error message:
> In file included from dict_dats.c:15:
> dict_dats.c: In function ‘loop_95__95__1’:
> dict_dats.c:6190:28: error: ‘PMVtmpltcstmat’ undeclared (first use in this
> function)
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:28: note: each undeclared identifier is reported only
> once for each function it appears in
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:46: error: ‘array_uninitize$clear’ undeclared (first use
> in this function)
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |  ^
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:68: warning: implicit declaration of function ‘S2Eapp’
> [-Wimplicit-function-declaration]
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
>  ^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:75: warning: implicit declaration of function ‘S2Ecst’
> [-Wimplicit-function-declaration]
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
> ^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:82: error: ‘BUCKET’ undeclared (first use in this
> function)
>  6190 | ATSINSmove_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
>^~
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:89: error: expected ‘)’ before ‘;’ token
>  6190 | move_void(tmp195__1,
> PMVtmpltcstmat[0](array_uninitize$clear S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int)))>)(arg2,
> ATSPMVrefarg1(arg0))) ;
>   |
>  ~  ^
>
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, command) command
>   |   ^~~
> dict_dats.c:6190:145: error: expected expression before ‘)’ token
>  6190 | lear S2Eextkind(atstype_int)))>)(arg2, ATSPMVrefarg1(arg0))) ;
>   |
> ^
>
> /usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39:
> note: in definition of macro ‘ATSINSmove_void’
>   284 | #define ATSINSmove_void(tmp, 

Re: Help with Templates, cannot find missing implementation somewhere...

2021-12-30 Thread d4v3y_5c0n3s
Ok, so I've been able to get the "dict" type to be abstract, but I can't 
seem to get "bucket" to be abstract.  I tried adding the "= ptr" part you 
suggested, but I'm not having any luck.  Using your solution, the code will 
compile, unless I test the "dict" type by calling "dict_new" & 
"dict_delete."  Looking at the error messages, the problem appears to be 
related to the "dict_delete" call, and I've provided the error below so you 
can see for yourself.  I know that there are a lot of details missing, so 
let me know if you'd like me to provide any more details.

Error message:
In file included from dict_dats.c:15:
dict_dats.c: In function ‘loop_95__95__1’:
dict_dats.c:6190:28: error: ‘PMVtmpltcstmat’ undeclared (first use in this 
function)
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:28: note: each undeclared identifier is reported only once 
for each function it appears in
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:46: error: ‘array_uninitize$clear’ undeclared (first use 
in this function)
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |  ^
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:68: warning: implicit declaration of function ‘S2Eapp’ 
[-Wimplicit-function-declaration]
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |   
 ^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:75: warning: implicit declaration of function ‘S2Ecst’ 
[-Wimplicit-function-declaration]
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  | 
  ^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:82: error: ‘BUCKET’ undeclared (first use in this function)
 6190 | ATSINSmove_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  | 
 ^~
/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:89: error: expected ‘)’ before ‘;’ token
 6190 | move_void(tmp195__1, 
PMVtmpltcstmat[0](array_uninitize$clear)(arg2, 
ATSPMVrefarg1(arg0))) ;
  |   
 ~  ^

/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~
dict_dats.c:6190:145: error: expected expression before ‘)’ token
 6190 | lear)(arg2, ATSPMVrefarg1(arg0))) ;
  | 
  ^

/usr/local/lib/ats2-postiats-0.4.2/ccomp/runtime/pats_ccomp_instrset.h:284:39: 
note: in definition of macro ‘ATSINSmove_void’
  284 | #define ATSINSmove_void(tmp, command) command
  |   ^~~

On Tuesday, December 7, 2021 at 8:08:48 AM UTC-5 d4v3y_5c0n3s wrote:

> Thanks, I tried something similar with the "dict" type, but completely 
> overlooked the "bucket" type.  I'll test this to see if it resolves the 
> issue.
>
> On Wednesday, December 1, 2021 at 12:28:15 AM UTC-5 gmhwxi wrote:
>
>> After taking