@@ -523,23 +523,23 @@ PP(pp_formline)
523
523
{
524
524
dVAR ; dSP ; dMARK ; dORIGMARK ;
525
525
register SV * const tmpForm = * ++ MARK ;
526
- SV * formsv ;
527
- register U32 * fpc ;
528
- register char * t ;
529
- const char * f ;
526
+ SV * formsv ; /* contains text of original format */
527
+ register U32 * fpc ; /* format ops program counter */
528
+ register char * t ; /* current append position in target string */
529
+ const char * f ; /* current position in format string */
530
530
register I32 arg ;
531
- register SV * sv = NULL ;
532
- const char * item = NULL ;
533
- I32 itemsize = 0 ;
534
- I32 fieldsize = 0 ;
535
- I32 lines = 0 ;
536
- bool chopspace = (strchr (PL_chopset , ' ' ) != NULL );
537
- const char * chophere = NULL ;
538
- char * linemark = NULL ;
531
+ register SV * sv = NULL ; /* current item */
532
+ const char * item = NULL ;/* string value of current item */
533
+ I32 itemsize = 0 ; /* length of current item, possibly truncated */
534
+ I32 fieldsize = 0 ; /* width of current field */
535
+ I32 lines = 0 ; /* number of lines that have been output */
536
+ bool chopspace = (strchr (PL_chopset , ' ' ) != NULL ); /* does $: have space */
537
+ const char * chophere = NULL ; /* where to chop current item */
538
+ char * linemark = NULL ; /* pos of start of line in output */
539
539
NV value ;
540
- bool gotsome = FALSE;
540
+ bool gotsome = FALSE; /* seen at least one non-blank item on this line */
541
541
STRLEN len ;
542
- STRLEN fudge ;
542
+ STRLEN fudge ; /* estimate of output size in bytes */
543
543
bool item_is_utf8 = FALSE;
544
544
bool targ_is_utf8 = FALSE;
545
545
SV * nsv = NULL ;
@@ -848,7 +848,7 @@ PP(pp_formline)
848
848
const int ch = * t ++ = * s ++ ;
849
849
if (iscntrl (ch ))
850
850
#else
851
- if ( !((* t ++ = * s ++ ) & ~31 ) )
851
+ if ( !((* t ++ = * s ++ ) & ~31 ) )
852
852
#endif
853
853
t [-1 ] = ' ' ;
854
854
}
@@ -4918,17 +4918,17 @@ S_doparseform(pTHX_ SV *sv)
4918
4918
STRLEN len ;
4919
4919
register char * s = SvPV (sv , len );
4920
4920
register char * send ;
4921
- register char * base = NULL ;
4922
- register I32 skipspaces = 0 ;
4923
- bool noblank = FALSE;
4924
- bool repeat = FALSE;
4925
- bool postspace = FALSE;
4921
+ register char * base = NULL ; /* start of current field */
4922
+ register I32 skipspaces = 0 ; /* number of contiguous spaces seen */
4923
+ bool noblank = FALSE; /* ~ or ~~ seen on this line */
4924
+ bool repeat = FALSE; /* ~~ seen on this line */
4925
+ bool postspace = FALSE; /* a text field may need right padding */
4926
4926
U32 * fops ;
4927
4927
register U32 * fpc ;
4928
- U32 * linepc = NULL ;
4928
+ U32 * linepc = NULL ; /* position of last FF_LINEMARK */
4929
4929
register I32 arg ;
4930
- bool ischop ;
4931
- bool unchopnum = FALSE;
4930
+ bool ischop ; /* it's a ^ rather than a @ */
4931
+ bool unchopnum = FALSE; /* at least one @ (i.e. non-chop) num field seen */
4932
4932
int maxops = 12 ; /* FF_LINEMARK + FF_END + 10 (\0 without preceding \n) */
4933
4933
MAGIC * mg = NULL ;
4934
4934
SV * sv_copy ;
@@ -5061,7 +5061,7 @@ S_doparseform(pTHX_ SV *sv)
5061
5061
5062
5062
base = s - 1 ;
5063
5063
* fpc ++ = FF_FETCH ;
5064
- if (* s == '*' ) {
5064
+ if (* s == '*' ) { /* @* or ^* */
5065
5065
s ++ ;
5066
5066
* fpc ++ = 2 ; /* skip the @* or ^* */
5067
5067
if (ischop ) {
@@ -5070,7 +5070,7 @@ S_doparseform(pTHX_ SV *sv)
5070
5070
} else
5071
5071
* fpc ++ = FF_LINEGLOB ;
5072
5072
}
5073
- else if (* s == '#' || (* s == '.' && s [1 ] == '#' )) {
5073
+ else if (* s == '#' || (* s == '.' && s [1 ] == '#' )) { /* @###, ^### */
5074
5074
arg = ischop ? 512 : 0 ;
5075
5075
base = s - 1 ;
5076
5076
while (* s == '#' )
@@ -5103,7 +5103,7 @@ S_doparseform(pTHX_ SV *sv)
5103
5103
* fpc ++ = (U16 )arg ;
5104
5104
unchopnum |= ! ischop ;
5105
5105
}
5106
- else {
5106
+ else { /* text field */
5107
5107
I32 prespace = 0 ;
5108
5108
bool ismore = FALSE;
5109
5109
@@ -5130,7 +5130,7 @@ S_doparseform(pTHX_ SV *sv)
5130
5130
* fpc ++ = ischop ? FF_CHECKCHOP : FF_CHECKNL ;
5131
5131
5132
5132
if (prespace )
5133
- * fpc ++ = (U16 )prespace ;
5133
+ * fpc ++ = (U16 )prespace ; /* add SPACE or HALFSPACE */
5134
5134
* fpc ++ = FF_ITEM ;
5135
5135
if (ismore )
5136
5136
* fpc ++ = FF_MORE ;
0 commit comments