Lines Matching full:instance
29 \ A ficl object binds instance storage (payload) to a class.
30 \ object ( -- instance class )
37 \ The NEW method creates and initializes an instance of a class.
41 \ cell 2: size of instance's payload
43 \ Methods expect an object couple ( instance class )
123 : catch-method ( instance class c-addr u -- <method-signature> exc-flag )
127 : exec-method ( instance class c-addr u -- <method-signature> )
131 \ Method lookup operator takes a class-addr and instance-addr
135 : --> ( instance class -- ??? )
144 : c-> ( instance class -- ?? exc-flag )
157 \ my-instance next ( does whatever next does to my-instance by late binding )
172 1 ficl-named-wordlist instance-vars
173 instance-vars dup >search ficl-set-current
206 \ Instance variables (IV) are represented by words in the class's
209 \ to the base address of an instance when executed.
218 : do-instance-var
219 does> ( instance class addr[offset] -- addr[field] )
225 do-instance-var
242 \ Needs the class of the instance to create
247 does> ( instance class pfa -- a-instance a-class )
262 \ Makes an instance variable array of 3 instances of my-class
310 \ the size of its instance variables in the class's size field
330 \ instance of the class. This word gets compiled into
338 : do-do-instance ( -- )
339 s" : .do-instance does> [ current-class @ ] literal ;"
345 \ Every class is an instance of metaclass. This lets
358 4 cells , \ instance size
360 3 cells , \ instance size
369 do-do-instance
374 instance-vars >search
377 0 cells , do-instance-var
380 1 cells , do-instance-var
384 2 cells , do-instance-var
387 3 cells , do-instance-var
390 2 cells , do-instance-var
401 \ create an uninitialized instance of a class, leaving
402 \ the address of the new instance and its class
404 : instance ( class metaclass "name" -- instance class )
407 here parent --> .do-instance \ ( inst class )
413 : array ( n class metaclass "name" -- n instance class )
416 here parent --> .do-instance \ ( nobj inst class )
421 \ create an initialized instance
424 metaclass => instance --> init
433 \ Create an anonymous initialized instance from the heap
434 : alloc \ ( class metaclass -- instance class )
442 : alloc-array \ ( n class metaclass -- instance class )
451 \ Create an anonymous initialized instance from the dictionary
452 : allot { 2:this -- 2:instance }
453 here ( instance-address )
459 : allot-array { nobj 2:this -- 2:instance }
460 here ( instance-address )
462 this drop 2dup ( 2instance 2instance )
467 : ref ( instance-addr class metaclass "name" -- )
488 instance-vars >search
492 \ This method leaves the stack and search order ready for instance variable
493 \ building. Pushes the instance-vars wordlist onto the search order,
505 here current-class ! \ prep for do-do-instance
512 metaclass => .do-instance
514 do-do-instance
515 instance-vars >search \ push struct builder wordlist
518 \ OFFSET-OF returns the offset of an instance variable
519 \ from the instance base address. If the next token is not
520 \ the name of in instance variable method, you get garbage
550 \ decompile an instance method
586 0 , \ instance size
594 do-do-instance
595 instance-vars >search
598 \ Convert instance cell-pair to class cell-pair
599 \ Useful for binding class methods from an instance
600 : class ( instance class -- class metaclass )
603 \ default INIT method zero fills an instance
604 : init ( instance class -- )
626 \ free storage allocated to a heap instance by alloc or alloc-array
629 : free \ ( instance class -- )
634 \ Instance aliases for common class methods
636 : super ( instance class -- instance parent-class )
639 : pedigree ( instance class -- )
643 : size ( instance class -- sizeof-instance )
647 : methods ( instance class -- )
656 : index ( n instance class -- instance[n] class )
663 : next ( instance[n] class -- instance[n+1] class )
671 : prev ( instance[n] class -- instance[n-1] class )