/* fild_7dw.c */ /* 7 = 3+4 Target */ /* Take a Control by the Number of Field. */ /* Modified Recyclable Object << 'firstwd()'. */ /* As I saw below, by using * isspace OR *from==' ', I can recognize field delimiter Blank (' '); * while by using * !isspace (NOT is space), I can capture the words at given field; * And tandem numbers of WHILE-loops becomes the field Number. * Now, here comes the first prototype of Field Number Controlled * given word Capture Recycable Object. * * I tested this for Win3.1 "DIR.Txt" by 'Pro134E.prj', and works fine. */ /* I wanted to make this one to be a geneic Based-on Field Number, Read and * Write control. Then it may be useful at various situations. * By a quick test, this did exactly what I wanted. */ /* Now, at any given field, I can skip or make it blank. * while () ++from; -> skip the field as if not exist. * while () *to++ = *from++ = ' ' -> make it erased (by white liquid paper). */ /* By this "Field_No2.c" version, suppose No Details of output control * is necessary, but just Field Number level control. * Column position Counter "i" is deleted. * -> Yes, this is working. When I applied to Win3.1 "DIR.txt" * It printed Field Shift in a few sporadic rows, since some of * them don't have the 2nd Field "Extention" Word. */ /* This way is out of 'main.c', but rather Recycling Object Control. * The 'main.c' can't control anything about. I already have * the 'Main.c' Control version by Column Position, so this would * be the best complement to it. Recycling Object like this is * so tiny, and go anywhere, and so easy to read and modify. Thus, * in this point of view, also the best complement to 'Main.c' * control. So, use this conveniently. */ /* Before this Object became "Sandwitch (upField, downField)" * it can apply Liquid Paper only the same column length of * original text, by this Field Control Object. */ /* Now, the "Sandwitch" and Liquid Paper goes on 4th Field. With * 'upField', 'downField' variables, Liquid Paper is moved into * 'main.c', with any desirable fixed column length. * UpField Object ** DownField Object * This one is for 'DownField' from 4th to the end. * Again here, I have Options, do I choose for mute-mode on 4th to end, * OR, do something else such 'break' to get out of While-loop. * I did the former: apply mute-mode to the end of 4th Field, and * TURN-ON into ALL-Print-mode. It worked pretty well. As I see * here below, in terms of programming, * * == Programming Note= * I only need to deal with up to the Liquid Paper Field(s). Then * the rest of Fields are just one line, * "Print the rest of All Fields, doesn't matter How many". */ #include <ctype.h> extern char *fild_7dw (char *to, char *from) { /* 1st: Capturing 1st Field(Word) */ while (isspace(*from) && *from!='\0') { ++from; } while ( !isspace(*from) && *from!='\0' && *from!='.' ) { ++from; } /* Between Words, Read Blank(' ') or similar */ while (isspace(*from) && *from!='\0' ) { ++from; } /* 2nd: Capturing 2nd Field(Word) */ while ( !isspace(*from) && *from!='\0' && *from!='.' ) { ++from; } /* Between Words, Read Blank(' ') or similar */ while (isspace(*from) && *from!='\0' ) { ++from; } /* 3rd: Capturing 3rd Field(Word) */ while ( !isspace(*from) && *from!='\0' && *from!='.' ) { ++from; } /* Between Words, Read Blank(' ') or similar */ while (isspace(*from) && *from!='\0' ) { ++from; } /* 4th: Capturing 4th Field(Word) */ /* Now, here is the mode-switch place, this 4th itself is mute, */ /* but after this All-Print-mode. */ while ( !isspace(*from) && *from!='\0' && *from!='.' ) { ++from; } /* To-the-end: Until end of line */ /* At the first time in this 'DownField.o', output-mode is ALL ON */ while ( *from!='\0' ) { *to++ = *from++; } *to = '\0'; return (from); }