mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
register-type: fix for void
This commit is contained in:
parent
7f4594c63f
commit
acce3a471c
@ -459,3 +459,8 @@
|
||||
(implements prn Uint64Extra.prn)
|
||||
)
|
||||
|
||||
(defmodule Pointer
|
||||
(register str (Fn [(Ptr a)] String) "Pointer_str")
|
||||
(implements str Pointer.str)
|
||||
(defn prn [x] (Pointer.str x))
|
||||
)
|
||||
|
@ -354,3 +354,10 @@ int String_index_MINUS_of(const String *s, char c) {
|
||||
*/
|
||||
return String_index_MINUS_of_MINUS_from(s, c, -1);
|
||||
}
|
||||
|
||||
String Pointer_str(void* in) {
|
||||
int size = snprintf(NULL, 0, "%p", in) + 1;
|
||||
String buffer = CARP_MALLOC(size);
|
||||
sprintf(buffer, "%p", in);
|
||||
return buffer;
|
||||
}
|
||||
|
@ -299,6 +299,44 @@
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#prn">
|
||||
<h3 id="prn">
|
||||
prn
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
defn
|
||||
</div>
|
||||
<p class="sig">
|
||||
(Fn [(Ptr a)] String)
|
||||
</p>
|
||||
<pre class="args">
|
||||
(prn x)
|
||||
</pre>
|
||||
<p class="doc">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#str">
|
||||
<h3 id="str">
|
||||
str
|
||||
</h3>
|
||||
</a>
|
||||
<div class="description">
|
||||
external
|
||||
</div>
|
||||
<p class="sig">
|
||||
(Fn [(Ptr a)] String)
|
||||
</p>
|
||||
<span>
|
||||
|
||||
</span>
|
||||
<p class="doc">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="binder">
|
||||
<a class="anchor" href="#sub">
|
||||
<h3 id="sub">
|
||||
|
@ -45,6 +45,7 @@ canBeUsedAsMemberType typeEnv typeVariables t xobj =
|
||||
PatternTy -> return ()
|
||||
CharTy -> return ()
|
||||
FuncTy{} -> return ()
|
||||
PointerTy UnitTy -> return ()
|
||||
PointerTy inner -> do _ <- canBeUsedAsMemberType typeEnv typeVariables inner xobj
|
||||
return ()
|
||||
StructTy (ConcreteNameTy "Array") [inner] -> do _ <- canBeUsedAsMemberType typeEnv typeVariables inner xobj
|
||||
|
Loading…
Reference in New Issue
Block a user