Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utcsrgv.UUCP Path: utzoo!utcsrgv!dave From: dave@utcsrgv.UUCP (Dave Sherman) Newsgroups: net.std Subject: Re: How to store video attributes in a text file - VT-100 format OK? Message-ID: <4156@utcsrgv.UUCP> Date: Fri, 4-May-84 14:50:21 EDT Article-I.D.: utcsrgv.4156 Posted: Fri May 4 14:50:21 1984 Date-Received: Fri, 4-May-84 15:26:27 EDT References: <1239@brl-vgr.ARPA>, <422@denelcor.UUCP> Organization: The Law Society of Upper Canada, Toronto Lines: 58 ~| From: apratt@iuvax.UUCP ~| It makes the code look a little worse, but in a C program, the "accepted" ~| modular-programming method would be: ~| ~| #define ON 1 ~| #define OFF 0 ~| ~| printf("This is "); ~| highlight(ON); ~| underline(ON); ~| printf("very"); ~| highlight(OFF); ~| underline(OFF); ~| printf("important\n"); ~| I know. If I only did the highlighting occasionally, that would be OK. Problem is, I have some quizzes which can only be done in C (they use structures and logic which are beyond the scope of any file-driven CAI language I have access to). And in these quizzes I often use underlining and the like. ~| That way, the functions could take care of sending the apropriate code. ~| Redefining putc will *not* work if you use printf, unless you redefine printf ~| as well. This is because the library version of printf would not use your ~| new and improved putc as a filter/translator/interpreter. You're right, of course. I forgot to mention in the original article that I also recompiled _strout with an #undef putc, so that it would link in my putc function. ~| ~| In text files, however, the ANSI standard is as good as any, but a little ~| verbose; writing an interpreter for it (to include cursor motion, screen ~| clearing, etc.) is not trivial. That's why I asked on the net - and received several! ~| Also, you should keep in mind that not a lot ~| of terminals have such features as double height/double width lines. Lots of terminals can't do highlighting either. That's fine - the terminal will do what it can. ~| Of course, these files would have to be run through a filter which interprets ~| the embedded ANSI codes and sends the appropriate termcap-supported codes. ~| This all is assuming, of course, that you want portability from UNIX to UNIX ~| as well as terminal to terminal. That's the whole idea. In my CAI system, text files are copied to the terminal with while((c=getc(infile)!=EOF)putchar(c);, so the same redefinition of putc that works for printf works for the text files. Dave Sherman -- dave at Toronto (CSnet) {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave