Hello there, funny enough you had me pull out my GoF book just to be sure, and guess to what you are referring to, because you didn't really ask the question clearly... but I'll attempt to answer.
There are 2 different diagrams which you could be wanting:
1) A State Diagram = Tracks a programs persistent state as the program executes, in a stepwise manner
2) A Control flow graph = A hierarchical logical way to mind map how the program should function
For the GoF book, they mainly use control flow graphs, having the function encapsulate other functions to hand control into other defined objects.
For tools on how to create them, there are 2 I've been having fun with lately, Visio 2010 which is in a free Beta right now, and Visual Studio 2010 also has UML modeling capabilities. You can currently create UML diagrams from existing code now, but you can't yet create skeleton templates of code from the UML diagrams you create(yet).
So those two programs would be my suggestions.
Out our company we recently started a special interest group just for the purpose of designing these diagrams.
We use Enterprise Architect
UML 2.0 compliant and it hosts a lot of stuff. But beware UML knowlidge is needed!
We looked into VS 2010, but it doesnt suit our needs. You cant nest elements.