[haXe] --neko-source
blackdog
blackdog at ipowerhouse.com
Wed Aug 1 00:01:01 CEST 2007
Ok here's a lot more info,
this segfaults don't know why.
value r = val_ocall0(utils,process);
but i've checked that both utils and process are object and function
resp. The assumption I'm making is the utils static object is
initalised in the modules main() method is that correct?
value executeUtil(char *name) {
// printf("got something here %d",cl);
val_check(hxLocalData.utilModule,object);
val_iter_fields( hxLocalData.utilModule,check, val_null);
field classes =
val_field(hxLocalData.utilModule,val_id("__classes")) ;
printf("_classes-----\n"); val_iter_fields( classes,check, val_null);
if (classes == val_null) {
printf("can't find function\n");
return val_false;
}
field hxdev = val_field(classes,val_id("HxDevUtils")) ;
printf("HXDevUtils-----\n");
val_iter_fields( hxdev,check, val_null);
field utils = val_field(hxdev,val_id("utils"));
printf("calling \n");
if (utils == val_null) {
printf("mmm, utils is null\n");
return val_false;
}
if (!val_is_object (utils)) {
printf("utils is not object\n");
return val_false;
}
printf("utils-----\n");
val_iter_fields( utils,check, val_null);
field process = val_field(utils,val_id("testing"));
if (process == val_null || !val_is_function(process)) {
printf("testing is not a function\n");
return val_false;
}
if (!val_is_object(utils)) {
printf("aha util is not an object\n");
return val_false;
}
printf("call the function\n");
value r = val_ocall0(utils,process);
//printf("got! %s\n",val_string(r));
return val_true;
}
Here's the module ...
class HxDevUtils {
public static var utils:HxDevUtils;
public static function main() {
trace("initialised utils");
utils = new HxDevUtils();
}
public function new() {
}
public function testing():String {
/* command:String prms:Array<String>*/
//return new
neko.io.Process("ls",["/home/rturner"]).stdout.readAll(); return "boo";
}
}
and here's my trace
f -> __unserialize
f -> __module
f -> __classes
_classes-----
f -> haxe
f -> String
f -> neko
f -> IntIter
f -> StringBuf
f -> HxDevUtils
f -> Std
f -> Array
HXDevUtils-----
f -> __name__
f -> main
f -> __construct__
f -> prototype
f -> new
f -> utils
calling
utils-----
call the function
/home/rturner/bin/geany: line 1: 4831 Segmentation fault (core
dumped) /hom
On Tue, 31 Jul 2007 14:12:16 -0400
blackdog <blackdog at ipowerhouse.com> wrote:
>
> is not functioning for me, anyone else? I get this
>
> HxDevUtils.neko(1): Invalid character 0x00
> Error : Failed to print neko code
>
> because I can't see the source, can someone tell me how I reference
> function "process" from C
>
> class HxDevUtils {
>
> public static var utils:HxDevUtils;
>
> public static function main() {
> trace("initialised utils");
> utils = new HxDevUtils();
> }
>
> public function new() {
>
> }
>
> public function process():String {
> return "boo";
> }
>
> }
>
> so far I have this ... but it can't find the module ....
>
>
> value executeUtil(char *name) {
> value cl = val_field(hxLocalData.utilModule,val_id("utils"));
> if (cl == val_null) {
> printf("can't find module\n");
> return val_false;
> }
>
> // printf("got something here %d",cl);
> field f = val_field(cl,val_id("process")) ;
> if (f == val_null) {
> printf("can't find function\n");
> return val_false;
> }
>
> printf("calling \n");
> //value r = val_ocall0(cl,f);
> //printf("got! %s\n",val_string(r));
>
>
> return val_true;
> }
>
> thanks
>
> bd.
>
>
--
http://www.blackdog-haxe.com/
"It is no measure of health to be well adjusted to a profoundly sick
society." --Jiddu Krishnamurti
--
http://www.blackdog-haxe.com/
"It is no measure of health to be well adjusted to a profoundly sick
society." --Jiddu Krishnamurti
More information about the Haxe
mailing list