` Printed Icetips Article

Icetips Article



Templates: Checking if an embed point has code
1998-04-23 -- Mike Hanson
 
Newsgroups: topspeed.products.c4


>Embeds get generated conditional to them containing code, so the generator
>can obviously tell 
>
>Isn't that what #SUSPEND, #RELEASE, etc are for?
>
>Why do you want to know?

Well, the embeds that I'm generating would prove the existense of code
in a local classes method.  If it's there, then I need to generate the
corresponding prototype in the local class defintion.

I ended up using the %BytesOutput internal token.  Something like
this:

#ATSTART
  #DECLARE(%HasMethod)
#ENDAT
#!
#AT(%LocalProcedures)
  #SET(%HasMethod, %False)
  #SET(%ByteCount, %BytesOutput)
  #SUSPEND
#?MyClass.MyMethod PROCEDURE
  #?CODE
  #EMBED(%MyEmbed,'My Embed')
  #RESUME
  #SET(%ByteCount, %BytesOutput-%ByteCount)
  #IF(%ByteCount)
    #SET(%HasMethod, %True)
  #ENDIF
#ENDAT
#!
#AT(%LocalDataClasses)
MyClass CLASS(BaseClass)
  #IF(%HasMethod)
MyMethod PROCEDURE
  #ENDIF
  END!CLASS
#ENDAT



Catch you later!

-=> Mike Hanson, BoxSoft <=-

www.BoxsoftDevelopment.com
Mike@BoxsoftDevelopment.com
boxsoft@compuserve.com



Printed December 4, 2024, 3:05 am
This article has been viewed/printed 35216 times.
Google search has resulted in 6 hits on this article since January 25, 2004.