When Microsoft Word released the source code for MS-DOS and Word, Ode to Code have to take a look at the functions. In this post, the author came along with a function ReplacePropsCA from srchfmt.c file.
What the author realized was that every function has an owner and the flow control is all wrong. There are also some hilarious notations.
Here is the code:
/* %%Function:ReplacePropsCa %%Owner:rosiep */
ReplacePropsCa(prpp, pca)
struct
RPP *prpp;
struct
CA *pca;
{
   Â
struct
CA caInval;
   Â
if
(prpp->cbgrpprlChp)
       Â
{
       Â
ExpandCaSprm(pca, &caInval, prpp->grpprlChp);
       Â
ApplyGrpprlCa(prpp->grpprlChp, prpp->cbgrpprlChp, pca);
       Â
if
(!vfNoInval)
           Â
{
           Â
InvalCp(pca);
           Â
InvalText(pca, fFalse
/* fEdit */
);
           Â
}
       Â
}
   Â
if
(prpp->cbgrpprlPap)
       Â
{
       Â
int
fStc;
       Â
struct
CHP chp;
       Â
struct
PAP pap;
       Â
if
(fStc = (*prpp->grpprlPap == sprmPStc))
           Â
{
           Â
CachePara(pca->doc, pca->cpFirst);
           Â
pap = vpapFetch;
           Â
}
       Â
ExpandCaSprm(pca, &caInval, prpp->grpprlPap);
       Â
ApplyGrpprlCa(prpp->grpprlPap, prpp->cbgrpprlPap, pca);
       Â
if
(fStc)
           Â
{
           Â
GetMajorityChp(pca, &chp);
           Â
EmitSprmCMajCa(pca, &chp);
           Â
if
(!FMatchAbs(pca->doc, &pap, &vpapFetch))
               Â
InvalPageView(pca->doc);
           Â
}
       Â
if
(!vfNoInval)
           Â
{
           Â
InvalCp(&caInval);
           Â
InvalText (pca, fFalse
/* fEdit */
);
           Â
DirtyOutline(pca->doc);
           Â
}
       Â
}
}
Read the rest of the post here:Â http://odetocode.com/blogs/scott/archive/2014/04/15/deconstructing-a-function-from-microsoft-word-1-1a.aspx