?? turbo-c.notes
字號:
(Message inbox:25)Date: Tue, 29 Aug 89 18:57:48 pstFrom: few@quad1.quad.com (Frank Whaley)Subject: Re: flex 2.1 for Turbo CTo: vern@cs.cornell.edu> Sorry it's taken me so long to get back to you - I've been out of touch> for about the last month.I didn't expect to hear from you soon -- hope your journey was nice.> I'd like to have your 'adjustments' for Turbo C, so if you still have> them lying conveniently around, please mail them to me. Thanks.After a little more fiddling, the changes are relatively small. Probablythe largest problem is that Turbo C does not yet claim to adhere to thedraft standard, so even though they support many "modern" constructs, theystill are not __STDC__. Thus the diffs from flex.skl (note the name): 62c62 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__ 104c104 < #if !(defined(__STDC__) || defined(__TURBOC__)) --- > #ifndef __STDC__ 134c134 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__ 390c390 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__ 482c482 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__and initscan.c: 63c63 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__ 105c105 < #if !(defined(__STDC__) || defined(__TURBOC__)) --- > #ifndef __STDC__ 677c677 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__ 1658c1658 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__ 1750c1750 < #if defined(__STDC__) || defined(__TURBOC__) --- > #ifdef __STDC__are pretty simple. BTW, simply adding -D__STDC__=1 to CFLAGS works, but__STDC__ is used in many Turbo C header files, and can confuse things.It would also mean that all flex-generated code must be compiled withthat flag.flexdef.h also had one small problem: 44,46c44 < #ifndef MS_DOS < char *memset(); /* should be declared in string.h */ < #endif --- > char *memset();as the Turbo C definiton of memset() is: void *memset(void *s, int c, size_t n);The 128-byte command line limit of MS-DOS prevents us from using tcc tolink the objects together, so I provide a tlink script, flex.lnk:-----\turboc\lib\c0l+ccl+dfa+ecs+gen+main+misc+nfa+parse+scan+sym+tblcmp+yylexflex.exe\turboc\lib\cl-----The blank line is required.The makefile needed a lot of hacking, so here it is in its entirety.I don't think it is completely finished, but I'll be happy to work onit more if you'd like. Some of the changes are specific to my environment(my yacc outputs ytab.c and ytab.h) and most MS-DOS people won't havecp, mv and rm. Some people like separate makefiles for differentsystems, but we like one makefile with obscene parameterization.I should note that all of my experiments with FLEX_FLAGS=-{c,f,F,e}have failed, mostly due to scan.c becoming too large to be a singlemodule. Damn toy operating system.-----# make file for "flex" tool# @(#) $Header: Makefile,v 2.3 89/06/20 17:27:12 vern Exp $ (LBL)# Porting considerations:## For BSD machines:# CFLAGS =# LDFLAGS = -s# LINK = $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS)# SKELETON_DIR = .# SKELETON_FILE = flex.skel# SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_DIR)/$(SKELETON_FILE)\"# O = o# YTAB = y.tab# FLEX = ./flex## For System V Unix or Vax/VMS machines, merely add:# CFLAGS = -DSYS_V## For MS-DOS, Turbo C:CC = tccCFLAGS = -DSYS_V -DMS_DOS -O -G -Z -ml -vLINK = tlink @flex.lnk/c/x/vSKELETON_DIR = .SKELETON_FILE = flex.sklSKELFLAGS = -DDEFAULT_SKELETON_FILE="$(SKELETON_DIR)/$(SKELETON_FILE)"O = objEXE = .exeYTAB = ytabFLEX = flex## the first time around use "make first_flex"#FLEX_FLAGS =FLEXOBJS = \ ccl.$O \ dfa.$O \ ecs.$O \ gen.$O \ main.$O \ misc.$O \ nfa.$O \ parse.$O \ scan.$O \ sym.$O \ tblcmp.$O \ yylex.$OFLEX_C_SOURCES = \ ccl.c \ dfa.c \ ecs.c \ gen.c \ main.c \ misc.c \ nfa.c \ parse.c \ scan.c \ sym.c \ tblcmp.c \ yylex.cflex$(EXE): $(FLEXOBJS) $(LINK)first_flex: cp initscan.c scan.c $(MAKE) flex$(EXE)parse.h parse.c: parse.y $(YACC) -d parse.y @mv $(YTAB).c parse.c @mv $(YTAB).h parse.hscan.c: scan.l $(FLEX) -ist $(FLEX_FLAGS) scan.l >scan.cscan.$O: scan.c parse.hmain.$O: main.c $(CC) $(CFLAGS) -c $(SKELFLAGS) main.cflex.man: flex.1 nroff -man flex.1 >flex.manlint: $(FLEX_C_SOURCES) lint $(FLEX_C_SOURCES) > flex.lintdistrib: mv scan.c initscan.c chmod 444 initscan.c $(MAKE) cleanclean: rm -f core errs flex *.$O parse.c *.lint parse.h flex.man tagstags: ctags $(FLEX_C_SOURCES)vms: flex.man $(MAKE) distribtest: $(FLEX) -ist $(FLEX_FLAGS) scan.l | diff scan.c ------BTW, thanks for a great tool.Frank WhaleySenior Development EngineerQuadratron Systems Incorporatedfew@quad1.quad.comuunet!ccicpg!quad1!few(Message inbox:8)Date: Thu, 31 Aug 89 14:57:36 pstFrom: few@quad1.quad.com (Frank Whaley)Subject: Re: flex 2.1 for Turbo CTo: vern@cs.cornell.edu> Thanks for the diffs and Makefile. I'll endeavor to integrate them> into the next release.One terribly important thing I forgot -- Turbo C (and most MS-DOS Ccompilers) provide only a 4K default stack. Not having thoroughlytested flex, I can't say that this is enough. The makefile I providedto you builds a version without stack checking code. I would suggestadding "-N" to CFLAGS, which will include some simple stack overflowchecking code. You may wish to include the following lines to main.c: #ifdef __TURBOC__ unsigned _stklen = 16384; /* some reasonably large number */ #endifIn addition, the flags in the makefile build a version with symbolsfor Turbo Debugger (like -g). You may wan't to leave these flags off(remove "-v" from CFLAGS and "/v" from LINK) or you may wish to providean "install" target like so: BINDIR = {/usr/local/bin | c:\bin} STRIP = {strip | tdstrip} install: flex$(EXE) $(CP) flex$(EXE) $(BINDIR) $(STRIP) $(BINDIR)/flex$(EXE)Regards, fewfew@quad1.quad.comuunet!ccicpg!quad1!few
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -