Rick Spence, I like much his articles. Thank you Esgici for your indications and material arrangement. I read all and I have no problem with CodeBlocks except how I get what the
CodeBlock has contained and I wish in string type. I will try to explain a little bit more with samples.
We have this demo, which is an almost perfect example or at least simulates what we now have as IDE. Where the actions are being inputed by users, stored into a string variable and passed to the text file (FMG file created by the IDE):
Code: Select all
#include <hmg.ch>
Function Main()
LOCAL cBlock, bBlock
SET WINDOW MAIN OFF
cBlock:=InputBox("Confirm your ACTION (function):","Define your action","MsgInfo('Action test')")
SET WINDOW MAIN ON
bBlock:={||MemVarBlock(cBlock)}
MsgDebugTitle("Types of variables") ; MsgDebug(' cBlock type = ( '+ValType(cBlock)+' ) ',' bBlock type = ( '+ValType(bBlock)+' ) ')
MsgDebugTitle("Content of variables") ; MsgDebug( cBlock, bBlock )
EVAL(bBlock)
Return Nil
On the other hand, we have the inverse situation of creating FMG file by IDE. Where we already have a PRG made by the user and we want to transform what is being executed (in memory running) into standard FMG text file.
Code: Select all
#include <hmg.ch>
Function Main()
LOCAL cBlock, bBlock
bBlock:={||MsgInfo('Action test')}
cBlock := hb_ValToExp( bBlock ) // I want this: "MsgInfo('Action test')", but seems in Harbour there is no way...
MsgDebugTitle("Types of variables") ; MsgDebug(' cBlock type = ( '+ValType(cBlock)+' ) ',' bBlock type = ( '+ValType(bBlock)+' ) ')
MsgDebugTitle("Content of variables") ; MsgDebug( cBlock, bBlock )
EVAL(bBlock)
Return Nil
What would be the difference between these examples ?
I need to get the function or the (nested) functions that are inside
{|| ...} (what's in red color)
How to get
cBlock with full information (not just "...")
This is the big question. If I have FMG file, I could read directly from the file, because is a text file.
Regarding this:
I believe that in my case with Prg2Fmg project, the compiler would have it because Prg2Fmg will only works by re-building the application with the user app. So Harbour, will have all the functions defined as ACTIONs. Otherwise, user's app would not be compiled with some error in their codes.
So in this case CodeBlock deserialize will never contradict the mandatory for Prg2Fmg because always will running and compiling at same time.
Claudio, could you tell me if it is possible to read (perhaps in the C language) the contents of a temporary variable and replace "{||" And "}" by quotes ? Or let say to replace "{" by "[" and "}" by "]" ? Which it would transform block for string ?