• Aucun résultat trouvé

Rational if if it If LQ!r~AL m

N/A
N/A
Protected

Academic year: 2022

Partager "Rational if if it If LQ!r~AL m"

Copied!
200
0
0

Texte intégral

(1)PO. Box480 Natck,Mass.01760. Rational .. Systcms,. Inc.. {617)653-6194. 10,. May. Dear. New. Customer:. is version. Enclosed. 1985. of Instant-C. contain:. 1.25. pocket of the.manual),. The two. diskettes. the Instant-C program, the library source files, a stand-alone version of the Instant-C editor, and screen programs your keyboard for configuring PC have IBM an or compatible), (if you don't a simple examo1e program.. (in the. back. for the editor. ,... Also enclosed in this package are a complete manual and release notes 1.25. The release notes detail some new features that aren't for version manual in the yet. The manual will be updated and reprinted in the near You automatically receive the updated version of the future. will send manual in your registration. you. if. to read chapters 2 and 3 of the manual ("Overview" and Started with Instant-C") to most quickly learn how to use The interpreter environment is much different (and much Instant-C. better!) than the traditional tools for C,you mqy have been using.. will "getting. You. '. want. Version 1.25 is missing a few language features. All registered users a free update 2.00 receive version Version 2.00 of Instant-C. will handle larger programs toand have auto initializers, will bit fields in structures, and the ability to load .OBJ files created by other compilers or assemblers. The features will be added in approximately and each feature may be available in a separate interim this order,Please be sure to send the registration/user agreement release. to us, we don't know where you since we can't send you your free update(s) are. Instant-C. is the fastest. if interrreter, and is the best environment find any problems in itVersion 1.25 that should be C. you c. for debugging fixed or improvements that we can make, please let us know about them as Please take the time to us about your problems soon as possible. we have received from and suggestions. The feedback our early users has been a tremendous help to us in our work on Instant-C.. If. tell. Sincerely,. LQ!r~AL Terence. encl.. '.. , .. M.. President. -. Colligan . ,. m.

(2) Instant-C. Release. 1.25. contains many important improvements.. This relea'üe of Instant-C major area: are:. The. z.. C. Support'. Language. C pre-processor support is nearly complete, allowing defines with arguments. Also, static initializers are now supported. jjetails below.. Editor. Stand-alone files or buffers. 4 times files editor faster. cc}I[: dos 2.0 support (pathnames, devices, etc.). plete imÉ)rDve1nents. Supports much larger reads. Library. '". 2. to. include more run-time consistency other improved checking, more functions, smaller/faster, and c86, with compilers. other compatibility Lattice, A math function included. library is. Debugger. Many Lr,provements, including support for multiple debugging (program while output to one virtual screens output to another). screen with interpreter/debugger. Environment. management is more reliable. Memory makes better use of system memory.. C. t,anguaqe. file. Instant-C. Support. Nearly all cases of static initializers (initializing declarations) are handled. The limitations ar-e: - initialized arrays must have the dimension specified, e.g., you must. say. long array[3]. =. {I,. 2,. 3};. instead of long -. array[]. =. {I,. 2,. 3};. are not handled in the initializer value list. static variables may be initialized, not automatic variables.. comments. only. —. l. —.

(3) C. Languagé,. 1ns't"á'RtL'C"R¿leá"g%t. 'co'ntÍñued. lú. 25. "até'"' )iandled", Genetral"' #defines" 'but again. with. a" Eew""li'ii!i¢átioñ¢ i keywords and "opeVators ' may not b,e "#cíeHned. F,.-,,- .i,'--, . - Mefine must be unbalanced 'well-formed' e. may contaixi no , , text bra.cke,ts by ,. ,parentheses, braces. . , or ", . ',. e you may not define' pieces of declarations.. j. i.. -. Features. New. initialization l. static supported. 2 3. 4. .. of long,. and. float,. -. {. is. double data. now '. .. ",. static initialization of pointer data is now supported. Static initialization of struet's is ñQW supported. Static initialization of arrays is now supported. Note , though, that Instant-C can't yet calculate the siZe of arraYs from"..your4 so you must provide. array, dimensions for ahy aFray initialization, be to ,initialized. The .leng,th sjpe of 'an""argument.'list is- now"" checkeá ' to "match :I; ;. ' -·".',': previous definitions or usage. . datᢠto zero"' j'ft there iSfno The' run' command 'now",:ré-i·ni'tializes!l'all'" explicit initializer, or to the appropriate value if declared" with g·. .. :. A. ,-. .. i. '. .. 5. L.. .. .. ,. .a,'na'T. i :-. -,. ,. :.. '. an. 7. .. ". "". .. :. : ·. '". :í--·. '". "-[-:. -. .1'¿-.':. .. initializer.. ,. tÑiefine 's with arguments. are now supported. Performance of operations on float variables ' version 1.01. " C', ' : C, ""- I' V' A . . ' - §. i" .-: T.... 8. .. :. .. 6. :. '. S'. '. ". g. U" A, ?. '. ',,. ' ' "' ' ' ; 7 " '- "?L..' ~5 .'." '." ..' .· . ,. is-. A. ^' · ·'. i!rlproved ,, '" '. '. "' ".·' u i.. "r. , Y m[·. over. i"': .'. , '. ... ",. T " i. Editor in jnstánt-C, gives be running on MS-DOS PC-DOS 2.0 or later. This is available in the stand-alone or Remember to use as the Instant-C built-in editor. well as editor DOS the exit command to return to the editor.. "DOS" comniand is added, which, like #shell You must you access to the operating system.. l.. A. 2. The editor command processor 'remembers' one command to the next much better than reading from disk is much faster than in. .. Y·. 3. .. F. default aÉguments from in veUion I. Dl. Pile version 1.01. ... .... function is available for the Instant-C editor. Function 51 añd doés éxactl'y 'that: ·your is called "check, format, re-edi±'í', it' and if""cómpilatióñ is correct, formats current buffer is compiled, "'..'Thi"s.: makes'¿"ít very thé-'eáiUr: and in you function leaves your oE"'youf' function4'"s: or:'t'o get forní easy for you to see the final changing Note: the "tidied up" before you continue. A. new. ... it.. -. 2. -. if. it.

(4) ,-Edi,t.o.r, .cpntjínüed ¿u"" ' ,'". , ' '. ·. -. '. Instant-C ' I. ·'. Release. 1,25. compilation is successful, the function or objects have been updated'"in the memory file. In the default PC keyboard configuration,. ctrl-P is bound to this function. The editor status line displays the bytes'remaining available "line. buffers on the status. -.. '. 4.. Instant-C. Function Library. is condensed distributed with DOS 2.0 file library a has source called LSI.C, library a. The. defined in. file. and and. called LIB.IC.. device support.. its. components. older "universal" library (which supports CP/M and DOS l) the distribution disks, but is not installed in DOS versions is called LSU.C. The differences lie in STDIO.IC, which by the STDIODOS.IC file (for DOS 2). The DOS 2 library will D,OS-l or".cp/M-86 systems. (rename LSU.C an'd-STDIOU.H to must be used for DOS CP/M-86.. -' I or The new Zibrary (LSl..C) has the following inprovements over. An. It. .. -. X. i l O. ' ,. .. .:. 1. 2. 3.. ' :.. .. .. More. IQ. rewind. 5.. -. """". with. plus. functions,. -.,.- ·2. -··.- d · ,. t'--"'. : :)'. :>-1.. STDIO.H). version. e.g.,. ANSI. C. C. standard.. fwrite, fseek, fte11, setbuf,. fread,. IVie. n'ew. i.e.,. translations). library is faster.. Both the DOS 2 and the improvements as well:. l.. is also on of IC.EXE. is replaced not run on. The fopen function uses the standard convention for setting the mode. The general form is {rwa}[+][b], either "r", "wU, or "a", (read, write, or append), by "+" followed optionally mode, by (no optionally binary update followed "b" for for. new/line 6.. are. '. file's. --.. it. t. The. Full support of pathnames; Fúll support of devices; Increased compatibility with libraries delivered with popular conformance proposed compilers,. 4.. for. previous "universal". library. have. other. string funcÉions (strncpy, strncmp, strncat); TÚ mempry mñnagement functions check for more error conditions, inclucÚng infinite retmems. More. of loops in the free pool chains, This preyiQuslY.returned aFeas, and overlaps of returned areas. will..: make.:it,easier'Tfor .you to detect and debug memory management -. 3. -.

(5) Library,,. continyea,. 7,""1ns'tant-C,"Rele=e!."l':. .. problems.. j. -. .. 'i.;. '". :. ""',". ":. '". '". :25. .:í.c;". r called to start your program for the #run coniÍñánd) ">erforms redirection of stdin and stdout based on the <'"and'> co-ñüéñtion.. 3.. _main,. 4.. The word. functions and. OUT. ?".. - - .. inportw and outportw, which perform the word instructions are now available.. 80'Í36. IN. T. 5. 6.. control-Z is for text output. A. fclose only to disk not binary).. now appended. by. files. opened. -' '(i.e., The expression value display The file FUNCVAL.IC is deleted. and _doub1e functions like are now built into the debugger. int However, you can still "roll your own" you'd like: the internal if display functions are used only display function is no user if '. ·. declared.. display functions are also internal with version 1.25. just: like the expression cíispla.y functions, however,'you can ·define(you-r.own _pdj etc: funetí?n"s'-i4f..: y'o"ú'..·would like. -A'-'new: ·rl,ibrary source'-'file, M'.ISCL'IB": IC"F'épl'á'c'és'FUNCVAL.IC, and is e!Qmbined: :in· LSl".C and?."LSU.C..L coñtái'ns main and some other The debugger. ·v-.,7-i. í " (' E S.... odds. 8.. " -. t .. "' "' r É ... ' ' · : - .. -L · - '-. zl .:. -} E ;. mathematics function has called MATH.IC.. A. The header examined in. 3 .,, C ,. S ,i. ,E '. ... ' · f.í. ,... It. and ends.. transcendental. file the A. library is delivere.d: with version 1.25,. the commonly It functions, such as ERROR.H. aváilable. SQRT,. trigCOS,and ATAN,. EXP, SIN,. defines the yariabíe: errno,. standard way. header conditions. be of the appropriate 9.. ,. ..L, " .,¿ -. file, type,. domain for PÍATH.H,. usually. and range. decláres'the double.. etc. which may be. errorfuñctióñs math. to. ". to define certain values for the For with other compilers. O_RAW, a contains #define for which or-ed or added to the mode parameter of open will suppress ascii..: "newline" ORAW is used for binary files). open in translation (i.e., assumed 1.01 binary mode, which was incompatible with some version compiler's libraries.. A. header. file. FCNTL.H is provided be compatible. library, to level-l example, FCNTL.H. if. '. Instant-C. Énvironnent. '. ·T. , \. '. } ,. l.. versión 1.01, but requires less version Instant-C wilt resize itself as can use nore is available. and uses memory only as and modify your programs, you load and 1.01 started.up.: with fíxéd needed. '-Versions before neqds,'(.scmrcé, allocations of memory for various user code, etc.), imbalanced. and these were sometimes Version 1.25 dynamically One major improvement needed. segments various as sizes these Instant-C. memory"thañ. 1.25. if it. .. -. 4. -. "...

(6) Environment, continued. Rélease. Instant-C. 1.25. before is the separation of editor buffers from Instant-C data, allowing much larger files, functions, or The "bad memory allocation" message dee1,arations to be edited. byt;es the dust.. mentioned. 2.. A. notabs may be used to eliminate from Instant-C output. This can be set to from #saved source files and from the editor.. built-in variable. new. characters tabs both. l. —. the way, pending the next re-publication brief explanation of the built-in variables settings in brackets ]: By. tab to remove. of the manual, here is available, with default. a. L. " ,. intnum. [oxcoj defines the block of interrupts used by there is a conflict Instant-C -- may be redefined 146 and with some other software/hardware (see pp. 161).. if. _stmcount. [IQ] defines the number of statements executed between 'checks for control-break interrupts -- may be set higher for slightly faster execution (at 10, ,represen·ts. about 10% overhead). "-This does' not- affect "the operation o,f the d'ebugger'or the #step command.. ,. it. ·', ,. .. .,. remcol. [24] defines the. '. ,. .. . ,. .'. i. ". column first that. that may be used by remain in in column startcolumn A larger number may be used the right, probably making a at the cost of longer lines.. comments. Comments column I, however. to move comments to. neater display '. tabwidth. Eight is a _tabwidth is alternative. very affects only displays by the #iist and #type commands. Otherwise, affects'the expansion of tabs to spaces. '[4]. defines the spacing of tab positions.. If. common. [O]. this is the. position,. column. or the. left. F. O,. number margin. of the. for. tab first listings.. source. discussed above.. notabs. [O]. screenlines. [24] defines the number of lines that may be output to prompt and pauSe suspends the screen before a "more?" May be set to 25 for 25 line screens, or to output. for no pauses at all.. O. Treatment of special. input characters. these is described below. Note: keyboard have configurable to likely. We are -are tentative assignments. macros in a subsequent release. ,. I. _notabs. it. tabindent. ". l. ctrl-C, -" -. i. . .. ctrlmX, ,·.'. ". or EScape clear entire. line of input.. L. , í.. -. 5. -.

(7) Backspace,. Ctrl-H, FI. ok. F3. or. ". '. "' Del, or Rubout erase last character ente'red. '. '. '."""'. '. " ·.; '· r. ,. ctrl-N. copy. line. character from corresponding positio.ñ, in entered.. ctrl-R. copy. remaining characters. And. sonnie. FlO. or. frequently. ctrl-j. ""25. Tnsta'nt'gC"Release"'"i:. Énvironníent, cOntinued. l. used. debugger. or newline the #step. last. last line entered. are built-in: from. commands. command.. F8. or. ctrl-l. the #step. in command.. F6. or. ctrl-O. the #step. out command. . . .. Instant-C. Debuqqer. run-time checking is provided in version 1.25. In particular, function returns validate the return address, before possibly returniiig., Th: Ís can happen to oblivion via a smashed return pointer. store checki.ng, bounds through bad pointers or off the end of an array. Array and indirect function calls will be checked.in Fhe. pointer accesses, next version.. More. if. ". l.. _. ,. r. · ¿. Several fixes and improvements are inacíe'in the #steí? c"ommands'in version 1.25. #step count, where count is an integer constant, cause your program to continue for count more statements, and will Of course any exception, explicit breakpoint then breakpoint. () function), or tracepoint will stop execution before hand. statement At the completion of a #step operation, the completed nuch (as in with displayed more 1.01). 1.25, source is sophisticated look-ahead is performed to find the next statement that will be executed upon resumption. Th:Ís is indicated by the next statement does not sequentially follow the "next>". a message such as "to conpleted statement ("if( )", for example), shown. and 99" Version displayed, the next then line is is line would a show do "next>" did look-ahead, although not 1.01 this (. 2.. If. it. line.. 3.. The command #pu, for documented in version. 4.. As. print unsigned, is now implemented. l.Ol but not really available.. It. was. discussed in Library, above, immediate mode expression In version 1.01, evaluation display is handled internally. (which with names of the form modify), could you functions library integer values or _double for double precision, handled int for Éhe display. These are no longer necessary, but they are. if. -. 6. -.

(8) .D9bugger,. -continued. Instant-c. still. functions (with names like pd for decimal output) are also internalized, but will be uéeci instead of the internal code have defined them. 5.. Debugger. display. commands. 6.. (see. #px. for. you. example).. Source code displayed in ffbacktraces and after steps is truncated Of at 80 columns for more consistent and readable displays. with you the can see the editor or #list course, text command.. full. Temporarily, there is a bug such that blank lines between functions may not always be properly retained between €Loading #saveing. The results are not horrible, and you may not even notice the problem. In any event, the results represent an improvement over 1.01.. ... Summary We". if. display functions #Pf and #p1£ are now available for the of floats and doubles, and work like the other such. still. 7.. 1.25. customize your can The debugging display. be used, so you will and evaluation displays.. present they debugging. Release. want.to hear about any problems. yoü may suggeSt, As Instant-C. you don't like. and,. always,. ,. certainly, if you like Instant-C,. it, tell. us.. . d. .. .. you may encounter, any improvements any successes that you have with. ... t. . .. .. ·. t. .. _. 7. —. and. tell. your colleagues;. if.

(9) Instant-C. User's Manual. '". Instant-C. User'. (Version. Manual. s. 1.01). Terry Colligan Ben. Rational Natick,. Williams. systems,. Massachusetts. December. ( ¢')t",·'lu!\'. I'?'i4. inc. 1)'\/ lí,ít Ot',ii S;y!;lr'lns,, ALL P!C.4i9U., tu SI á'\g fjj:. Inc.. 31,. 1984.

(10) Instant£"". User'sManual. Instant-c User's. Manual. rights reserved. No part of this publication stored in a retrieval system, or form, any any means, in transmitted, or by photocopying, recording, or electronic, mechanical, otherwise, without the prior written permission of Rational Systems, Inc.. may. All. be reproduced,. Disclaimer Rational SYstems, Inc. makes no representations or warranties, either expressed or implied, with respect to the adequacy of this documentation or the programs which describes in merchantibility regard to or fitnessit for any particular purpose or with respect to The to produce any particular result. its adequacy computer and documentation programs are sold "as is," and the entire risk as to quality and performance is with the buyer. In no event shall Rational Systems, indirect or for special, direct, Inc. be liable consequential damages resulting from any defect the documentation, programs, or software. some states do not allow the exclusion or limitation of implied warranties incidental for or liability or consequential damages, above case in which the and not apply limitations exclusions may to you. ci-86 is CP/M. Inc.. is. trademark. a. registered. a. Instant-C is Intel is. a. Lattice-C is. a. computer. Innovations, Inc. of Digital. trademark. of Rational. trademark. trademark. a. of. of Lattice,. ms-dos. is. a. trademark. of Microsoft,. PC-DOS. is. a. trademark. of. UNIX. Inc.. is. a. trademark. Systems,. Inc.. corporation. of Intel. trademark. Research,. Inc. Inc.. IBM.. of Bell. Telephone. Laboratories,. '"""": '""Y'\':¿bf · "g:q 1 !?"y ?4?;t![.){!,'j' C" C é.·\t·".. i"2¢' "' i ! n 1( ':l { 3 ;·:. RÉ·g: l"'t j"v/f ! ).

(11) Instant-C'. ". User'sManua!. Table. of. Contents. chapter. l. Introduction. 1. Chapter. 2. Overview. 3. 2.1 2.2 2.3. of Instant-C. Components of Instant-C Organization of Instant-C Flow the Pieces Fit Together. 2.3.1 2.3.2 2.3.3. The Interpreter The Editor Executing Your. Those AllHandling. Where Are Source File. 2.8.1 Structure of Files 2.8.2 The Instant-C 2.8.3 File Summary Chapter. 7. programs. 8 9. 3. C. 10 10. Tools?. II 12. Íjisk. Source workspace. 4. Using. the Instant-C Editor. Creating new functions Modifying Existing Functions. 4.1 4.2 Chapter. 5. Running. Programs. Expressions Functions #run coinmand Overview Debugging Interrupting Your Program. 5.1 5.2 5.3 5.4 5.5. i' '. 13. 17 17. Disk. Trying the Interpreter. Chapter. 13. 15. Getting Started with Instant-C. system Requirements Up Backing the Instant-C Running the Test Program. 3.1 3.2 3.3 3.4. "'. 7. What. 2.6 2.7 2.8. : i '-HU . .. : '.' ' ' ;j'\ \' ": ' ;'":v"tr '\\'-. 6. Style Differences r Type Something if Incorrectly? Interpreter output. 2.4 2.5. ;'j. 3 4. 18 18. 21 25 25 26 29. Executing. 29. Invoking. 31 32 32 33.

(12) Instant-C". User'sManual. Debugger. 5.6. chapter. 6. chapter. 7. Commands. Instant-C Interpreter. Chapter. Command. Reference. Using. Instant-ED. Comnand Line. 7.1. 34. Instant-ED. 8. 8.6 8.7 8.8. Editor Editor. Key Functions. 87 87. Reference. Starting the Editor Editor Terminology Display Layout Editor Modes Modes Editor Input OVERTYPE) Command. Files. Syntax. 8.1 8.2 8.3 8.4 8.5. Command. on. 39. 89. 89 89. 91 91 (INSERT. and 92. Mode Summary. for the. 94. 95 97. IBM-PC. 8.8.1 Moving the Cursor 8.8.2 Deleting Characters 8.8.3 Ínserting Characters 8.8.4 Changing Editor Modes 8.8.5 Moving Text 8.8.6 other Editor Key Functions 8.8.7 Leaving the Editor Chapter. 98 98 99. 99 99. lOó lOó. Instant-C Function Library. 9. lC)1. Library Categories Instant-C Library Functions Description. 9.1 9.2. 9.2.1. Character. type. 102 106. and conversion. functions 9.2.2 String Manipulation functions functions 9.2.3 Memory Management 9.2.4 standard TO Functions 9.2.5 Formatted IO functions 9.2.6 Low Level Routines 9.2.7 Interrupt Support Functions Appendix. A. How. Instant-C Differs. 106 107 108. llO. 115 118 120. froin. Standard-c. A.l A.2. Extensions Not Features. Yet. 123 123 124. Implemented. (":L)L","|(jí"i 1\| i. Rl(. jf{í. " '!"1. C,; in L,j {}'q l : '.

(13) Instant-C' zíppendix. B.l. B.2. B. Internal. C.l. C.2. C. User. Messages. Error. Language. Appendix. User'sManuai. "^. and. Explanations. 125 140. Errors Errors. sumnary. of Instant-C. Commands. Commands. Internal D. Language. Áppendix. E. How. to. Summary. 149. Install Instant-c. List of Distributed Files e.i E.2 configuring Screen Output E.3 Configuring the Keyboard E.4 Building a New Instant-C E.-5 Modifying Your Instant-C E.6 Configuring a New ED E.7 Changing Interrupts E.8 Making the Library Smaller Appendix. F. Editor. Keyboard. Functions. F.l Functions to Move the Cursor F.2 Functions to Delete Text F.3 Input Mode F.4 F.5 F.6. Text. Management. Editor Commands Miscellaneous Functions. Appendix. G. Known Bugs. Appendix. H. Reporting. ( '\ ji", ' :.":" } i muj F'jü': ' k l7,n c'C;. ,' ¿Gy'S.f ;1 C" /k¡ l j}{/ 4; l ' : ¢á¿'>1 ll¿f l ?. ;. Blocks. and. 143 143 147. Commands. Áppendix. 125. Problems. Problems Suggestions. and/or. 151. ISl. 154 156 157 159 I6Q 160 161 163 163 166 168 170 171 173 175 177.

(14) User's Manual. Instant-C.

(15) lnstant"C. User'sManual. "'. ,N,R,,U,,,ON. chapter. I. Introduction Welcome to which. preter faster,. Instant-C. (tin),. an. optimizing. inter-. programming language than ever before. and 8088, compatible CP/M-86, PC-DOS, MS-DOS,. your willand make simpler. It 8086, Intel the under microprocessors, MP/M-86 operating systems. Version I supports all or C standard except language for: features parameterized #defines, declarations initialization, a general in compound statements, bit fields, assembly language interface, and certain obsolete operators. It includes the Unix Version 7 C compiler The functions. void data type for non-valued function library provided with Instant-C is designed 7 from Bell to be conpatible with UNIX Version Íjaboratories, and with other C compilers for the and CI-86 8086, Lattice-C particularly the ccmpilers. operates. easier. C. on. features of any C In addition to the normal programming provides a unique compiler, Instant-c improve environment which greatly your will C language productivity while creating or enhancing have because occurs we programs. This improvement the made edit-compile-run shortest cycle the possible, often less than two seconds. Instant-c. enhancing C language.. C. is not only effective but is also. programs,. for developing and best way to the. the. You can run Instant-c on an IBM PC or compatible computer with at least 320K of memory. Instant-c CP/M-86, MS-DOS, under any run of pc-dos, should have at least 280K MP/M-86 or CCP/M-86. You available for programs on your system Instant-C can You is available. up use to 440K of memory. will. if it. 'l'"y'} "1 l \ l ",·1\', " ',j' $"y ,tfí¡í' , 1')(' tj t l?|,',f í"ty, j,{" f,t {"\'j j.l ,. l.(.,7\.t':. Chapter. l. Page. l.

(16) "". User'sManual. Instant-C. INTRODUCTION. one floppy disk with at least get started. need. eapacitY. 240KB. to. This manual assumes that you already know C. We do not attempt to teach you the language. you are a beginner to C but know Basic, we suggest that you get a copy of the c Proqramminq Guide by jack Purduni (QueC corporation, 1983). Many of the programs in the Guide have been tested in Instant-C. Proqra]nming. If. a are beginner to C, but don't know you have (arIf think Basic is a mistake that should corrected long ago), we suggest that you get a of The cO. Programming Tutor by Leon A. Wortínan. Themas. Sídebottona. (Robert. j.. Brady. Co.,. BasÍc been copy and. 1984).. This Instant-c User's Manual does not completely i-t does define the C language, nor serve as a a The c copy reference for C. You should have of proqraIrlIninq Lanquage by Brian TG. Kernighan and 6eríni": we m R: Ítchie (prentice-Hall, 1978). will refer to this book several times in the text- as "K&R".. Instant-C is. ambitious. undertaking;. is the. it system of its kind. In any software of this first complexity, especially in one so new, there are To reach our objective of to be bugs. likely bugs from Instant-C, need eliminating your all Please inconsistencies, help. report any problems, an. we. Appendix you encounter. or inconveniences details on how to do so. We will greatly any help you can provide.. provides appreciate. G. purchased You have the most effective tool C developing and enhancing language programs. hope that you enjoy using. will. Conventions. it.. Used. this. i-n. Manual. examples and indented. are set exainple is interactive (as opposed to the sequence of a library routine), we show what types by using this.. All. off. italics like. Page. 2. for We. Chapter. i. If calling the user an. (.(}r}y'{t-í'"l !" y' ltúl}lC'lá¿t!. l'j. b';':. :. l ?)(¿j t "t :,. '>¿: -·¿. ií. 1'"{ ii '! t'?i Sí ji'\/i l.

(17) User'sManual. Instant-C". ~ERV-IEW-. chapter Overview. This chapter understanding of better use of. chapters. It various parts together.. 2. of Instant-C. framework your provides a for so that you can make Instant-C, the information in the following cjf what contains an overview the how they work are and of Tnstant-C. new kind of programming Instant-C is a environment was inspired by a for the C language. number of computer science research systems such as and SMALLTALK. IUACLISP, INTERLISP, you are systems, you can probably skip familiar with these the rest of this chapter.). totally. It. (If. We designed Instant-C to greatly speed up theC many in which edit-compile-load-test cycle spend niost of their tine. programmers Instant-C canC be as much as lOó times faster than the traditional language tools.. 2.1. Components. of. Tnstañ_t;;C. Instant-C contains to tools. C. Compiler. C. Interpreter. ',J,!i 1 . ,':.,·',,' ' t · : - ' .' i ' :7',.'-'tt-"; ' j-'l' j1 ',7 : if; I,l í,",: l f. Converts executable. in C. source machine. language text instructions.. into. (Not interactively. programs generally available in other products.). Runs. C. Chapter ,. that of components programming traditional. number. a. correspond environments:. 2. Page. 3.

(18) Instant-C". ""'"""'""' _QVERVIEW. Full. Screen. Editor. Creates language. Linker/Loader. and. text.. modifies. functions a single. Combines. files into Pretty Printer. Reformats has a understand,. the. C. source. front multiple program.. source. language source text so that easy standard, to read and it (Not layout. generally available in other products.). Function. C. Library. pre-written versions operations, such as reading or &'riting.. Provides commonly. file. C. used. Language Debugger Helps debug and trace C programs examine and modify both programs data. (NOt generally available in. source. products.). System. Checker. (LINT) Checks. multiple. that. C. programs. (NOt generally products.). your. 2. .. 2. programming. organ,jz,at,ion. needs. o,f. and and. other from. are consistent. files available in. source. In Instant-C, all of into a single, unified. made. of disk. other. these components are combined which handles system of for the C language.. all. T.n.s,t,a.n,tÁc. two You can as think of different Instant-c cooperating programs, the interpreter and the editor, which automatically and invisibly invoke all of the other components as needed to perfect your program, which co-operating you night view as a third You switch back and program. forth between the editor and the interpreter and don't even have to. Page. 4. Chapter. 2. ( (1(.·,/: ;h{ ""·-' ("l .J;"n'i-; i/j/·. PaL,l,í,)T|cl ,· ' ·-' 7 '-. '. 'Qt·, i I';'".

(19) Instant-C". User'sManual. '. QyF,pvTFTÑT. think your. about the programming.. other tools that. are. helping to. speed. Since you usually be using Instant-C to work which are interactive (read from your on programs keyboard and write to your screen), you actually have with: the to interact Instant-c three programs and own interpreter, the Instant-C editor, your You can think programs as three program. of these different parts of the total Instant-C environment:. will. I. Interpreting. reads The interpreter your commands and executes them, either directly or via Some the debugger. of the interpreter commands switch you to the editor and switch to your program. others Generally, the interpreter acts on your input one line at a time.. will. Editing. 2.. The editor reads full-screen yourC cominand characters and manipulates Some language source of the text. editor command characters switch you back to the interpreter. Generally, the editor acts on your input one character. at. Executing. 3.. a. Your Your. time.. Program program. can switch back to the by calling exit interpreter the function. Instant-C will also automatically switch back to the interpreter makes an error, such as your program a dividing by zero, or if it encounters breakpoint. The style of interactions when is in your program control obviously depends upon your program Although with only one of these interact you will programs at a time, you can switch rapidly and easily Since there between then. is a different style of understand should you interaction in each program, how they are different to minimize confusion. The these between are programs differences three described in more detail below.. if. l ( j:', ' 'ni : /Qt L f2lCu l Tfj. '.-u: c. l/j. S-,l it\v/t f ). Chapter. 2. page. 5.

(20) Instant-C"'. ""'"""'""' OVERVIEW. the. How. 2.3. pieces. Fit. troqether. following diagram shows how the three basic together, and how you can of Instant-c them. (The labels on the arrows switch between will be explained in the following text.) The pieces. fit. operating. System. i. ^ l. ic|name ]. l. i. ). V. i. Équit #ed name. I. l l !. !. Debugger. ]<. #run,. ^. !. l. funct()j. I i. + i. ~. ~. ~. information. it,. out.. 6. i l I l. your. program}. i. each For explain when to use how you can in. É'age. l l. !. is Notice that the interpreter controlling piece, invoking either your the editor to carry out your commands. 'Í'his below.. Instant-C Editor. :. ©NP+. ~. Instant-C Libraries. l. errors). i. Your Programs. l. (No. return, exit, exit {in (breakpoint encountered) (runtime error). !. V !. Ctrl-F. Ctrl-Q (Qüit). l l. "l l. I. Instant-C Interpreter &. i. '. is explained of the three. it, how get into. Chapter. you. it,. 2. the central programs or. in more environments,. detail. we can that you're and how you can get. tell. ' '.':'· t l ':"j '\, -i:l ' f":, : 'C: C'f',il t":7 :,h_" ' : , t -?.,}i Hi-: -:i ! : g.. l fi. I',! 1· 'ji I '.

(21) instant-C 2.3.1. The. User'sManua!. "^. OVERVIEW. Interpreter. You can tell that you're interacting with the interpreter by the "# " prompt it uses and by the (The interpreter starts full line style of input. the executing your commands when you press return. key.). You use the interpreter for the overall control of ljnstant-C, to load and save your programs, to test your programs, to set breakpoints, to display data, and to invoke the editor. by Enter the interpreter typing the IC comniand to t-he operating system, by returning from the editor, t'>r by returning from your program. You can get out of the interpreter by typing the command. (But wake sure you save your work see the #save command in the Command Reference chapter.). quit. first!. 2.3.2. --. The. Editor. You can interacting with the tell that you're screen format with two editor by the distinctive by the lack of screen, the of status lines at the tap and Kjy the single character style of the "# " prompt, interaction. You use the editor enhance existing or modify or create your. C source text or to (That scmrce text. to most pro9raln"3.) You You can also edit frequently edit a single function. decZacatione7. The editor global data or #define a always works functions or copy on of your The place where the copy is stored is declarations. called the current buffer.. fix. create to c'. is, will. Enter the editor by typing the #ed command to the interpreter, or when the compiler finds a syntax error in a C language scmrce file that you requested Instant-C to process.. ( "' : .",,: ",: j' t'.V !i,i; :. t:. i. j'l'. '"'a'. Chapter. í\ñí-< í',,'Q,t[-"y",'.. ' { ; ': j?f. iii. i "\'[. l",.': l '. 2. Page. 7.

(22) lnstantwC'^. lAer'sManual OVERVIEW. editor and typing the. leave You can the Instant-C interpreter. to the (ctrl-F on most keyboards), cause Instant-C to try will the contents of the editor's to compile current the compiler finds no errors, your buffer. If and you will be returned functions will be updated, compiler finds an error, the to the interpreter. the error message will If be displayed on the top line of your screen, and you will be left in the editor. by which. go back command. F. You can also leave the editor by typing the command q (Ctrl-Q on ínost keyboards). the In this case, contents and you of the editor buffer are discarded immediately the are returned Instant-C to The c functions and/or declarations you interpreter. were editing are not updated in this case, since just the copy in the editor's buffer is discarded. Executing. 2.3.3. You execute. test. it, or to. Your. Programs. either to. your program use. it.. You can normally because program the interpreter or the have a distinctive style. tell. it will. recognizable.). try. it. out,. to. that you are executing your than either act differently (Your program may editor. of interaction and be easily. You start executing your program by typing a valid For function call while you are in the interpreter.. example:. or. #. main();. #. printstatusg3). :. You can stop the interpreter. executing your program in the following ways:. and. get. back. to. program calls the function exit or _exit I. Your directly.. function interpreter. The. 2.. Page. 8. that. executes. Chapter. you a. from called return statement,. 2. the or. Coy,' t". ,. Á\jl'. f[,l tlí ÍfGii Á\ ' tut: "'. ' : 'j'.l} : }{. '.

(23) User'sManual. "". Instant-C. OVERVIEW.. the. reaches. end oE. the function.. breakpoint you set is execution of your program. A function that you have returns.. 3.. a. 4. 5.. Your are. 6.. Your. program. completes. single stepping. a. a. statement while your program.. runtime. division 7.. You. or. 2.4. interrupt. Ctrl—c.. your. program. is called or. traced. through. makes program by zero.. during the. encountered. by. error,. you. such. as. typing CtrI-Break. Style Differences. an advance Instant-C is such over the generation of software tools for the C have been confused by language, some people the Here are the most common areas differences in style. some (hopefully) clarifying of confusion with explanation. Since. previous. comincm thing to edit in Instant—C is a environments, function; in traditional the only Since thing that you can edit is a disk file. and then edíted a disk files must be loaded function at a time, a very common error is to work ed in filename, which doesn't try For information, more see the Instant-C. below. section on Source File Handling,. l.. The most. 2.. may you have worked with other C tools, compile make you nervous not to your each program. Instant-C automatically compiles the editor. function when you leave form. kept always in compiled programs are This is further explained in the next section.. If. explicitly. it. All. 3.. (Ú,·,c;'t !:,,Í:t,)!j,!'. Chapter. í.\i--.-;. f',v :¡c'Íí',, g t".; ¿ |·:)i. :' ; : ": íff f-mli':. :". explicit. similarly, there is no linking for you to worry. !'1('. n. l\. about.. 2. loading or Instant-c is a. Page. 9.

(24) -.' '- i .' ' .i·.' ¿t. ':. 4.,,w· ' ", S " OVERVIEW. compile-to-memory for a separate does of. all. compilation.. 2.5. if I. What. Type. q -"" ·' "' {-Tµ.¿*" ·- :¿.. sYstem, and bypasses the need linker or loader. The compiler necessary during the linking. Something. Incorrectly?. correction of keyboard input errors depending upon whether the interpreter, the editor, On MA-DOS PC-DOS and is in control. or your prograír, systems, system's uses the operating the interpreter On input eáiting. the ILLX PC arid compatibles, the ESC key cancels the and t.he function line, currerít a previous line. keys allow you to edit anc^ re-enre-r. will differ. CP/M-86. On command. and compatible systems, an interpreter can be car,celled at any time befare you is cancelled Ty entering a control-C, cir ESC; the characters previously input and the "# " prompt away cleared. line. hit control-x, be will redisplayed.. It. On CP/M-86 and del keys. baced. input line.. We. RETURN.. system. or programs. The editor are detailed. systems,. the. backspace,. eontroI-H, character on the character to match the used to.. erase the last willchose these you níay be. has many ways in the chapters. to correct input, on the editor.. Methods for correcting input to depend on the program of course, functions involved.. 2.6. iííterpreter. and. they. will,. your program the and library. Output. by information displayed general, the In interpreter is output one line at a time. twenty-three lines have been printed on the screenIf since the last keyboard input, however, the output. Page IQ. Chapter. 2. l ' '"a ( .{\j '."' 'í;'i! '"y' 4,]' lj"' 'u C\'.'. ,:" tj":'·' 'I! 'i' , ,.

(25) User'sManual. ""'. Instant-C. OVERVIEW. will will. special cease and a (controj-C to abort)".. will. prompt "more? appear Output resume and the "more?" prompt be erased, when you key any except you don't want to continue, you control-C. can to the return from command execution directly (This Instant-C interpreter by entering a control-c. pagination of interpreter output is controlled by the _.screenlines system variable.). will. If. hit. output from the Instant-C interpreter wish. you directed to your printer cmtfile ccmmand in Chapter 6. if. 2.7. w!"iere Are. Ali. Those. be. can See. the. Tools?. we Earlier, listed of all of the components Instant-C. We then described in detail the only two and the that you interact with -- the interpreter These two programs editor. create an environnent in which of the other tools are automatically all invoked The following is a repeat as needed. list of those t.QQis, with an indication ofWe which tools are and when. hope this helps automatically invoked, to dispell some of the mystery of Instant-c.. c. compiler. C. Interpreter. Tool.) Automatically invoked give the save cominand (ctrl-F) editor or when you execute a #load command in the or The interpreter. compiler is only a you save noticeable when large function because of the <Light delay for it to finish its work.. (Invisible. when you from the #inclucíe. (Main. Full. screen. Environment). The "Control center" between Moves you environments, as well as doing the more C executing the traditional job of statements and expressions you type.. of. Instant-C.. Editor. (Second. Instant-C. (jt';"',Í.. t',:. Uj.1Á. 1)'\/ ft.: t FY'¿f' S Y'¿)!E"'/)j jug , /'i\( l i?j' ;;"{ c-, Al cjf nvr l",. Environment) to change. Chapter. 2. The main. or. in. way. create. your. Page. ii.

(26) User'sManual. I\a. Instant-C. OVERVIEW. programs.. Linker/Loader. (Invisible. as part process.. pretty Printer. invoked Tool) Automatically compilation of the (invisible). (Invisible Tool) Automatically part of the editing process.. invoked. as C. Library. Function. These routines are included as part of They are Instant-C. not exactly invisible, but rather passively wait for you or your program to call them. Source. Language. Debugger. This tool is integrated interpreter. is visible It commands several extra interpreter. System. with the only as the in. (LINT). Checker. (Invisible. Tool) Automatically invoked when you do a save command in the editor a disk load by typing you or when #load command. You see an #inclucie or as additional error the system checking messages exactly like the normal syntax error messages.. file. 2.8. Source. File. Handlinq. consist of multiple source disk designed be Instant-C to with existing C programs and compilers, we have added a number of commands to deal with multiple Since simultaneous source no disk files. other deal with multiple interpreters for any language source the following overview of disk file files, handling should understand what you is help Most. files. compatible. c. programs Because. we. happening.. Page. 12. """""""" ". ". Chapter. 2. { :(-}[}\,'//!Í'|l L'y ¢¿,lt|í")l',·li S)y¿ (("Íi',, Al L lií(íH T g; glí :it. ".rt'i i"'\. µ'jj. l i.

(27) Instant-C'. User'sManual. '. OVERVIEW. 2.8.1 Structure of order. In disk with disk. C. Source. Disk. Files. understand how Instant-C deals with understand how the systems you should organize trying to be compatible are C programmer, you are an experienced. to. files, files. (If want to skip you the rest of this section.) In program your compiler environments, traditional source disk files. There consist of multiple will are normally two kinds of disk files: which. we. may. C. source. Disk. Files. contain the function definitions (The function your program for definitions are all of the executable There code in Yotir program.) way also be data declarations in them, but normally, source disk files consist of The names mostly function definitions. disk files usually end in for these ".C". These. Header. Disk. Files. and data contain declarations by #define definitions that are shared multiple source disk files. Each header by one disk file is invoked or more #include source disk file with an statement. The nantes for header disk files usually end in ".H". These. 2.8.2. The. Instant-C. Workspace. compatible c existing with existing C programs, Instant-C simulates multiple disk files by organizing its symbol tables into separate tables, one for each disk file. source disk file and one for each header Since each disk file inside Instant-c will have a symbol table with the same name, you can easily whether become very confused trying to understand scmething happens on disk in the Instant-C work or To help minimize space. that confusion, we will fron now on always refer to files on disk as "disk fíles", symbol table and the corresponding inside Instant-c To be completely and language systems. (O,'i;" ?;,,lm: "ii t:y. Chapter. '"-'.i ! ,' $t" :\,,. !',£. 2. Page. 13.

(28) Instant-C"". User'sManual OVERVIEW. files".. as "nemory. program with Instant-C, you need to load disk files into memory in the Instant-C workspace You give one #ioaíí command with the #1oad ccminand. The disk file in your program. for each source header disk files are loaded automatically, as specified by the #inciude statements source in your a header add can also explicitly disk files.with(You a #loaci command, of course.) file To run. a. C. as Instant-C always has one memory file designated current memory file. Any new declarations or functions you type in the interpreter are added to Since the end of the current memory file. you can look at local data in the current memory file, you to switch back and forth between will probably need The #use command does exactly that. memory files. The #use command can also just display what the name of the current memory file is. the. the #new you wish to create a new memory command do so. In addition, you can give the #new command to clear out the current memory you wish to start over.. If. file,. will. file. if. Finally,. on disk, to store your changes permanently code from memory to move your source its fíle(s) disk file(s). You use to the corresponding #save the command to write memory files to disk #save command writes the current memory files. a The file to named disk file.. you need. Page. 14. Chapter. 2. \ :CV-' ,m;'íl $mú·lt"n, ,'"y i ?í'::i{:/t,'í. ' í'í.i ,. i' I.

(29) Instant-C 2.8.3 File. User's Manual. "". OVERVIEW. summary. In summary, each disk corresponding memory workspace . The following. f lle. a. file of. C. language. source. it. to. commands operate. on. files:. (: (?{";,·'[¿;lÍ: i:y É: .(c'.fÉ,Ü. All. lí'?'}lííS,. load,. #1oad. save,. #save. Reads memory. the disk. file.. file. Writes the current. f lle.. use,. #use. new,. #new. jg'¿ Sv: .telY$:., liíC: !'U3f i?V['f). Makes memory Creates. existing. f lle. a. contents memory. f lle. memory. a. new memory memory. file.. Chapter. 2. has. in the Instant-c. be. into. file to the. memory. a. the disk. current. file, or clears. an. page. 15.

(30) "". User's Manual ,GETTING. Page. Instant-C. STARTED. 16. Chapter. 3. (.'t')t..}\'";(: '¡| tj\, K:,'tt/)'l¿i a l l ií:. ma. S>·>'Í. "l¿S.t. '. '" ' C) j;"i tjf l t Lj'i l i.

(31) User'sManual. "'. Instant-C'. GETTING. chapter. STARTED. 3. getting started with Instant-C. install. This chapter how to you Instant-C, example how to use the small program included with the package to test Instant-C, and how to using Instant-C by typing commands to the interpreter.. tells. start. system. 3.1. RequireInents. Instant-C is designed to run on an IBM pc or pc/xt ccünputer with at least 320K of memory. Instant-C under run any of PC-DOS, MS-DOS, CP/M-86, MP/9I-86 or CCP/M-86. (Multi-user or multi-tasking such as MP/M-86 or CCP/M-86 may operation systems have You should more nnteniory.) require significantly at least 26OK available for programs on your system. Because of the space your operating system takes, you need at least 320K in your machine. Tnstant-C can use up to 440K of memory is available.. will. will. if it. much disk need capacity to run drive. run on a single 320KB disk Instant-C; Since Instant-C does not use the disk except to read and write up you can your disk Instant-c, and then replace the Instant-C disk with a different disk containing your own c programs. You. do. not. it will. files,. Instant-C requires Version or. 1.25. MS-DOS.. Instant-C works well on protection requiring that disk.. ( ' 9[ \/-';tí' jjc\ t t:',' ,1!,J,l : :$ ,"'V:' t ' .,n . '.. \1, ! |¿|{ ;fí U) j?f Q:t híil l }. or later of. disks; it reference. hard. it. chapter. start. 3. I?C-DOS. has no copy any floppy. Page. 17.

(32) lnstant"C"^. ""'"""'""' getting. 3.2. STARTED. Backinq. Instant-C Disk. the. Up. Before make starting to use Instant-C, you should working copies at least two distribution of the One copy is diskettes. for backup; the distribution a Since second backup. as diskettes can serve distributed on single-sided Instant-C is sometimes and/or single-density diskettes, you may want to change the format of the copies to make more space available for your programs. so, you should not make your backup. If Rather, use DISKCOPY you should to COPY use to copy the disk files from the Instant-C disk to your backup disk.. using Instant-C on a computer with only floppy disk drive, you will probably want to install your operating system on the disk so as to make your Instant-C disk "bootable". a. you If single. are. this is If all never made. incomprehensible you to you, or backup disk before, please go get some help We from your dealer or a knowledgeable friend. haven't provided enough introductory material here to teach you. have. 3.3. Runninq. the. if. a. Test. Proqram. have To confirm that you successfully installed and verify that Instant-C onto your working disk, Instant-c can handle existing C language source disk a test disk file, FIELLO.C, on files, we have included program prints on your disk. This your distribution screen the words:. Hello,. World!. (This is the very program described in K&R.) HELLO.C with the operating you display the disk system command type, you see the following C. first file will. page. 1 8. " """" ". "". " ". Chapter. If. 3. ( 'c p-wi ñ-;!',í ' ' i;'-'1 g:y'3t{'|í'g; "iq í:'v ! í,íl'(}r\dj A ) fill iH ]" g; Rh S!- íi'\' ! f.:.

(33) User'sManual. lnstant"C" ". ,,,,,N,. ,,,,,,,. program: main() {. printf("Hello,. }. Running. the test. World!\n");. program. l.. Start. 2.. Add the program (The workspace. 3.. Tell Instant-C to. up. requires only three steps:. Instant-C.. to the Instant-C workspace. contains a copy of the programs functions that ínstant-C is currently or handling.). starting. have your computer.. this. execute. proqram.. Make sure that you Instant-C is easy. disk inserted in the Instant-C working Then, type the command:. up. A>ic. After the operating Instant-C, the following version 1.01, copyright (C). December 1984 by. system has messages 31,. found. will. loaded. and be. displayed:. 1984. Rational. Systems,. Inc.. #. "# " prompt The indicates that you are in and i: ñstant-C's interpreter is ready to process "# chosen because (The " was commands. your somewhat the Instant-C command level is c compiler.) input of a traditional preprocessor. it. like. into your Instant-c. To load HELLO.C comnand:. the. #. type. load "hello.c". Instant-C main #. Jyím;ñt { { ' 1984 by \i,tí 1()1iéí" S\/sit'iÍ's AL l Rl( íl { rs tit SÉ. workspace,. " """ : nc. lí'jí. D. will. respond. with the. message:. defined.. ". "" ". Cha'pter. "i". page. 19.

(34) Instant-C"'. User'sManual GETTING. '. STARTED. has completed you that compiling main. it syntax had been any in there the disk file, errors switched If would have automatically you to Instant-C the built-in editor so that you could correct the error. Then, to run this program, simply enter the C. telling. language #. phrase:. main(). Instant-C. will. with:. respond. Hello, world! # When. you the use system: #. finished. are. quit. command. with your Instant-C session, to return to the operating. quit. A>. You can. Instant-C. executing command:. also give. filename when the effect of. a. This has #lQad the. ic hello Instant-c will. If. command.. start up automatically you type the. you. A>. version 1.01, copyright (C) main #. December 1984 by. with: 31,. 1984. Rational. systems,. Inc.. defined.. At this point in the previous. Page. respond. 20. you can case.. main. execute. Chapter. 3. or quit,. just. as. { ,|',/t|,: "|¡ '-u" 5:'v:n·," '. l' .; ' [(i"\)"Í¿í! fit i líií ii4 l ¿: jii j: i f' ,'1 !. t';.

(35) Instant-C. 3.4. User'sManua!. "'. GETTING. STARTED. Trj'inq the Interpreter. To gain some familiarity with how Instant-C try interacting with the interpreter.. start. up. have your computer;. Instant-c Instant-C. then. type. as before: Make sure working disk inserted the command:. works,. that you in the. A>ic. After. Tnstant-C,. the operating the following. version 1.01, copyright (C). December 1984 by. system has messages 31,. loaded found and be displayed:. will. 1984. Rational. Systems,. Inc.. #. Now,. to. #. 17. Tnstant-C. try. some. interactions, with:. respond. should. type:. 17 #. Each time. you. type. a. Instant-C will evaluate an appropriate format. expression.) Now, #. try. a. it. bit. C. and (17. more. language expression, display its value in simple is a very complicated:. 3-i'4. will. You. something. valid. see: 7. #. (,1'll'.'":. :'|'.. '.'t',.1. l,',' 'lí.;: '(:'::'} :'W ::t:Ti'., l"C ·" L ' I?:.' ;y;t jíi s:j ij'\/[ : ). Chapter. 3. Page. 21.

(36) lnstant"C". User'sManua' STARTED. GETTING. Or: #. 5. (3+4). *. will. You. see: 35. #. Integers are displayed started as sonething #. decimal. as. numbers,. if. even. else:. they. Oxff. (Oxff is print:. 'ff'. in. hexadecimal.). Instant-C. will. with. 'x'). 255 #. Similarly, #. (leading. octal constants to decimal:. converted. are. C). no. 0123 83. #. is. try scme of the fancier left shift):. You can #. 3. <<. operators. C. (. "<<". 2 12. #. You can type #. "This is. (The double should see: #. You can #. Page. 2 2. things other. 'a'. much. integers:. than. easier. than. quotes. define. a. "This is. much. easier. also type. char. coínpiler!". a. string constant.) than. a. You. compiler!". constants:. Ial. " " " " """ " ". ' ". Chapter. "3. ". )."K. ". li. /\!. ií¿|: "")l':t' ,. iy ' t;',t (-j',,'.fÉ'['|'-. Í: jf ;f{ i t. líl. '"".i. l "( $"'1 t' j'j t i.

(37) Instant-C. User'sManua!. ". GETTING. STARTED. #. can you Finally, call functions (toupper is a library function that converts a char to upper case): #. toupµer('CV): 'Q'. #. Try other expressions to explore how c operators confidence gain work and to in interacting with the When you are finished, you can return interpreter. to the operating system by typing: #. quit. A>. and (HELLO.C) and You have compiled run a program a function (toupper) See how have invoked directly. chapter easy is to use Instant-C? Read the next to learn how to create new programs with Instant-c.. it. """ "" " ".1,[ " " " i'}¿\'j ,/ ¿,1'; 1') it: ñ ' " ;,1' 7)\' jcne, : \' At l Rs\ ,' i \ :", iu í: i {j ,/i i"'. ". ". Chapter. 3. ". " ". ". " "Page. 2 3.

(38) User's Manual. Instant-C"". EDITOR. Page 24. Chapter. 4. (,"|r: \,'·l(:'t: ¿'yf.: rl?[:í"y H:::i[.::',ti All [{!: 'ÁiiT:_,i·{ls,f[{"."il.:. '"¿i.i t:'..

(39) Instant-C. User'sManua!. ". EDITOR. chapter Using. the. 4. Instant-c. Editor. This chapter is an introduction to the editor in enough so information includes that Instant-C. It edit you can any declaration successfully or function, but it does not cover all of the features of the editor.. 4.1. Creating. new. functions. In Instant-C you To create a editor.. command: #. create new function with the simply function, type the. new. ed funname. is the name of the function you wish to Instant-C will shift to the editor, and will a template prepare of a function definition for you. between disk Instant-C can't distinguish file a nantes DO NOT and function disk names. use the nante of instead of the name of a function -- you can't file edit a disk file with the editor in Instant-C.. where. funname. create.. keys To insert text, use the arrow to move the where to the place on the screen the text cursor should The editor will already be in .insert go. mode. characters (not In this mode, any normal control or function keys) that you type go onto the and into your C program. screen you wish. to Ifthe key.. ,",. . . .. , ,' '. ',' . ( Ít. ,. "y. ". to delete characters, character to delete and first The character will disappear,. Chapter. 4. Rove the cursor press the Del and the screen. Page. 25.

(40) '. Instant-C'. User'sManuat EDITOR. will. be updated. appropriately.. When you are finished defining the function, type Ctrl-F to have your function automatically compiled. function, your there are no errors in your If function will be formatted and you will be returned to the Instant-C interpreter.. however, the compiler finds an error in your be in insert you in the editor, The cursor be placed mode. at the point in your the error, and program where the compiler discovered be displayed on the top of the an error message screen.. If,. function,. will. will will. left. and inserting After correcting the error by áeleting characters, you can again try to compile by You can repeat this typing ctrl-F. cycle as many wish times as you until you have successfully compiled. your. program.. If. you decide. to abandon the editing you are doing, You will return to ctrl-Q instead of ctrl-F. Instant-C interpreter, but what you were editing not be compiled, nor will any of your programs will be updated. be in the sanje state Your programs will they were in before you started editing.. If. you don't out of. type the. have your. time. tc\ program,. finish. getting. all of the. you have three choices: The is to simply put comments around the erroneous text, and then save the program normally. The second is to use the Write command in the 8 conímand mode see Chapter editor's for more The details. third is to use CÉif q and #endif to conditionally omit the portion in error.. errors. first. --. 4.2. Modifyinq Existinq Functions. To make. a. change. function that has Instant-c workspace,. the. Page. command:. 2 6. or. improvement been you use the. already. Chapter. 4. c an existing loaded into the saíne Type process.. to. i;gG.1 ( U) yú 'g'íl S,",/:,rt"| 17, ,: it b'y f',.1t,l()I,,í ' í\' i, fAí 'jLi T E) R l L7l l Z\JL { ).

(41) Instant-C'. User's Manual. ' '. EDITOR. #. ed funname. the name of the function you wish to this is the name of a function and The current not a disk file name such as HELLO.C). definition of the funct ion will appear on an editor The editor will be in insert mode, so screen. that and you can use the same insert and delete process the same ctrl-F and ctrl-Q mechanisms to control your modif ications. where funname is (Again, modi fy.. Since you often will be editing the same function repeatedly, Ihstant-C allows you t¢j edit again the on by omitting the last function you were working name. of the function to edit. That is: #. ed. you edit the last function you were editing. will omit the function the first timeIf that name argument you u"e the editor, Instant-C will print an error message. To Chapter. edit. disk. 7. Instant-c'. on. s. editor.. See Chapter. editor.. " """""""" '":(.il";ti¡l(}{É{. '9M. l:"v !Q,'!'("'"¿l! Sy: ';lf'!rÍ"iS. !!ÍÍ' At L- KK: i-i"lS Ri'"SLfñ'i'l'. 8. f i.les outside of Instant-C, version. using. for. "" " ". "". the. more. "". stand-alone. details. "Chapt"er. 4. on. ". the. " """. see. of. Instant-C. "" ". ""Page. 27.

(42) Instant-C". User's Manual RUNNING. Page. 28. " '. PROGRAMS. Chapter. 5. '"".', c.üµ,t ,f\l f": ,"·!t":;":'y !',{|q}'í/l' l : 1.\l l 6\ :li7 y, l{f j;j f¿',/i ( '.

(43) Instant-C'. User'sManuai. "d'. RUNNTNG. chapter Running. This. Instant-C. 5.1. chapter and. Executinq. 5. programs. all of run. covers you how. tells. PR9GRAMS. to. the your. commands programs.. in. Expressions. Whenever you are interacting with the Instant-C interpreter, you can enter any valid C expression for immediate evaluation. Instant-C will execute your expression and For display the resulting value. exaniple, #. 2+3*4. will result in the following display: 14. external or global data variables can be used, as in the current as any static data variables memory outside of any fileFor if they are declared function. the purpose of recognizing names, your expression is treated as though it were in a function at the bottom of the current memory file.. Any. well. on into calls Instant-C converts your expressions functions, and those functions actually built-in do the displaying. Different functions are called depending upon the data type of the expression. The specific functions called to to display the values of expressions are: some. ,,·. ÍA'.Á. [ q,i ' ( I ' \ L : ' : \ 'i I i,; l {\\ : :i I h ', , Ai ' jtj' :: l g Iii ,51 t? t l } ' ,. Chapter. 5. Page. 29.

(44) Instant-C"'. User'sManual RUNNING. PROGRAMS. Display the value of char expressions. (Note that there are relatively few char since expressions, chars are expanded to ints they are conbined with anything in an expression.) else if. char. Display the value of short or short expressions. (Similarly, there relatively few short expressions.). _short. rñsplay. int unsigned. the. int expressions.. of. Display the. value. rjisplay the expression.. value of. of. int expression.. unsigned _long. value. int. are. a. unsigned. an long. or. long. or. int. a the Display value of float expression. (Pote that there are few since float expressions, floats are expanded to doubles in most contexts.). float. _double. the. Di"play expression.. _string. Display the. _ptr. Display the value of as a hex value.. expression. "In the preceeding expression "2+3*4". value value. (some-thing. example,. to the. of. of. a. double. a. pointer *).. char. declared. char. all other pointers. Instant-C. converts. the. call:. ínt(2+3*4); and the function int actually displays the value. All of these functions are provided in source form so formatting your that you can edit them to satisfy You can you wish, even, desires. delete the if from the functions, so that no display statements output is displayed. We think, however, that you find these displays a reassuring confirmation will the system is doing what you asked that it to.. Page. 30. ". Chap"t"er""5. ". """. "'""""'". """"-"" "" (".(.'["j"','H',;i;;. "l'.: i; (' t. S'",'"1b'.>Íy·1 rw íI"t!Í()l)ri| i;j /"\ I : f'i 1('; ' l J' : , f'?É''".i l'?",' i [ '.

(45) Instant-C. 5.2. User'sManual. "^. RUNNING. PROGRAMS. ínvokinq ninctKns. Any function in the Instant-c libraries or in your directly from the interpreter. program can be called You simply type a norínal function call complete with and and commas, the parens Instant-C the function returns a value is function. not declared void), Tnstant-C print value as above. described in the section on expressions. If. will. will call (i.e., its. The printing of function results is one of the most You can easily powerful debugging aids in Instant-c. by calling of your program the test any sub-piece You function, and examining the resulting display. can also easily vary the arguments to the function to see how the value changes.. this printing of the resulting value can confusion because you may not think Since a value. of a C particular function as having language the definition requires all functions with many no specified data type to be treated as int's, must be of the functions you think of as non-valued The ínost treated as int functions by Instant-c. Main() function. frequent surprise is the main() and print run your program out the last value will computed in main -- often a neaningless value. This since you in most other environments may confuse change main() You can this can't return a value. behavior either by changing the main function to be a void, or by changing the _int function. However, sometimes. cause. case in the main() Instant-C tries to help without converting any definitions of main() specific data type to data type void instead of data. type. ;'·j,,.4 ig't |'"1(1)\' lh: 'tc:'á' SY',;t"u'\t' /'.1 ! fll{',i ; ' ", Ljj '3í m.'r l). \' '¿lj'Y'. int.. Chapter. 5. Page. by a. to. 3. I.

(46) Instant-C". User'sManual RUNNING. 5.3 So. PROGRAMS. #run. command. that. you. test the main function of programs we separate have .EXE or .CMD command. For more details, see the the #run command in Chapter 6.. can. files,. will thebecome provided #run that. description of. 5.4. Debuqqinq. Overview. has powerful debugging capabilites that No available to you. special libraries, separate are options, or utilities The debugging offered by facilities Tnstant-c fall into three categories:. Instant-C. always are compiler necessary.. Interpretation. the Because Instant-C has interactions perform you can a of an interpreter, number of actions that are or impossible Immediate with a compiler. execution lets you call a function directly to view value and any be varied Arguments can side-effects. invoke each tinte you the function to verify proper operation. Variables can be displayed or modified at any time. Execution your program may be of interrupted to allow you to examine progress path or to pursue a different. difficult. its. its. of execution.. Fast. Modification. Because is sq your programs,. it. and easy to change debugging techniques methods formerly called "brute-force" and For efficient. now elegant are example, calls can be inserted in a function of to display the values certain variables, the or to record. fast. printf. Page. 32. """". """. ". chapter. 5. l-.:'l,',.:'·.i||' !·y líc?!|[: ":,l,. ".·\ .,I,-"'. '-'I' - " ?. '.

(47) lnstant"C". User's Manual. '. ,,NN,N, ,,,,R,M, events. The function of sorne tested right away, and once the information is obtained, the debugging removed in a watter be code can of debugging seconds. Thus, Instant-c's be extended and can capabilities occurance be can. customized programming. Debugging. by. your. commands Commands. available to specify to be traced, to or stop execution of and to examine variables execution history.. are. functions that start, continue,. program, your and the program. 5.5. Language. c. own. Interruptinq. Your. are. Program. take place after your activities running and is interrupted. voluntary: call is made to a #trace command), call is made to the breakpoint function (i.e., _()) function, or is interrupt Most debugging has program started Interruptions can be traced function (see. Control-Break. a. a. a. interrupt. issued from the keyboard. on MS-DOS are available. or control-c keyboard. interrupts. The and pc-dos. systems only. by zero, include division Involuntary interrupts function, stack overflow, call to an undefined or typed dissimilarly difference taking of the. pointers. A call to the yÓuexit function is considered program can see how your so that an interruption terminated. When. entering #. i. "'. '"'i. a. example,. = 3/0. ** Execution command line. l?:·,""í;'|!. For. in:. Results. \ !. displays. interruption occurs, Instant-C describing the interruption.. an. message. ". \.}. |'1(' i 1,;| ¿:"·1 !i; : If'"."; y /\t l fül' l : t(,? [?1 c)l j?\/[ j'!. " ""' " " ". "". division. interrupted:. Chapter. '5. ". by zero. " ". " ". in. Page. 3 3.

(48) Instant-C. User'sManual running. programs. the message After interpreter level.. execute of your. fV. any statement, program.. is. You. displayed, issue. can. or (usually). you any resume. are at command,. execution. The stack, or history of function calls to the and you can interruption, is preserved, look at it At with the #back command. interpreter level, you and can display variables, evaluate expressions, statements execute c language including calls to C The language you functions. enter to the is evaluated in the context of the interpreter function that was interrupted, so '{ou can examine or modify in local, or automatic, variables declared that function. use the term "active" 'to describe functions that The interpreter on the stack. can execute in the context of any active function by using the €Loca1 command. #local specifies the function to use. We. are. calling other functions from the interpreter may another in interruption. Interruptions result stacked The back themselves may be or nested. command shows stacked any the of level The #reset command allows you discard interruptions. Levels unstack should be any or all levels. or discarded when you no longer need them, to prevent confusion and to avoid possible stack overflows.. 5.6. Debugqer. Commands. described commands The debugger are chapter 6, but an overview of each is offered here that you can see how they work together.. fully. in sc). The commands into several categories: those executions (#go, interrupted resuine or abort and #reset), those #step, that manage breakpoints those that display values (#trace and #untraee), and (#Pc, #pd, #po, #ps, #px, and #local).. fall. that. has been Any execution that interrupted Resuming execution resumed in several ways.. Page. 34. Chapter. 5. can be much. is. {".('Ig,'"\:. '9üa. ),|. l: t Rc¿!'('rí,,1, , ..,/, ,,. '.·. t (.

(49) User'sManual. ". Instant-C. PROGRAMS. RUNNING. from the like a executing return C language statement The various ways your can resume your interpreter. program are: #go execution at the poínt resumes of proceeds and interruption, untíl your program returns to the interpreter or another interruption occurs.. breakpoint resumes execution, but at the end of the next statement. This and is the finest level of control, allows you step through your program or and observe portions of your program,. will. #step. the flow of control.. #step. return. breakpoint resumes execution, but when the interrupted function returns. command is useful in quickly This bypassing functions that are not of For direct concern to your debugging. example, you have been single stepping a step return function that calls speed' execute at completes. You can then resume. will. will let printf until itstepping single. printf, 'full. if. appropriate.. #step. out. resumes execution, when the current. but will breakpoint function calls another function or returns. This allows you to by follow the execution of your program stepping from function call to function call or return, without line-by-line detail.. #step. in. resumes execution, and like #step break at each statement, but not notify you of calls to other functions. This makes easier to use a single execution command to examine the of a. will. will. it. function.. #step. exec. c statement. unlike. is exec statement. a. "". (,,,. !.. ,,t L:' 'cl. ". i-,,.: ,; :",'.. Y' FIÑI .',, L !-|1 ,F t i: ,. lit. li'. :} i 1"(Í',l ¿{\,'j t'. """. the a. other. step. commands, step C language. 'call' to the This is used. function without. Chapter. 5. having. to 'step into' to explícitly. """. É'age 35.

(50) Instant-C"'. ""'"""'""' programs. RUNNING. #trace. example, #. it. and. then call. step. exec. main(argc,. call will immediately. level. argv). will. commands. to display. number causes down. interruptions to level number. specified, zero is levels are discarded.. function. #trace. For. main and upon entry to main.. You can use the following debugger in various ways and memory of your program: #reset. it.. break. to control the. data. the and. discarded be no number is assumed and. to. If. all. name. breakpoint interruption will occur the next time that the specified function is called or returns. If function name is omitted, a list of all traced functions is displayed. a. #untrace. function. name removes the. trace request from calls or returns to the specified function. If function name is omitted, all trace requests are cancelled.. #pc,. flpd,. #po,. #ps,. #pu,. #PX. expression. count. from the location display storage of expression, (like a C language lvalue), count under locations, for the appropriate printf format (character for #pc, decimal for #pd, etc.).. #iocal function. name Sets the context for evaluation expressions and at interpreter function name must be an active. (otherwise. of. names. level. function. automatic references to are variables class name no function is given, the name If of the current local Upon is displayed. function interruption, the interrupted function. storage meaningless).. Page. 36. Chapter. 5. .. tqn! (fc.:[.'yi I!'y l"?rii!["!{\{3,: SyyífeiÍ'!<",. 1!..iM. 1!"\{". Ai i Ft'( }f i TS RL S É.Fi'j i t }.

(51) Instant-C. User's Manual. "·°. RUNNING. automatically is function. #ack. (),\,."l:. jífr1 Sy'-;l.rjf7jb !ízg ,;\: l"a!}('í',?: f.?!'F!c¢'v'r[) .All, í::l!":i^'F:. the. local. Displays the sequence of function calls and to the point of interruption, also any displays previous interruption levels that have not been #reset .. ""' " "" ". ¿-!]!!. made. PROGRAMS. "". cilapeer. "g""""". '. ' ". " " ". Page. 3 7.

Références

Documents relatifs

If seQ TCP/IP is not installed, if you already have this maintenance supplement on your system, or if you are not in system maintenance mode, custom tenninates at this

The parameters you can change in set up include communication and printing features, and also such functions as terminal control mode, display characteristics,

CP/M has several control characters and single-key commands that allow you to edi t a complex command line before you send it to the computer with a

TeleVideo Systems, Inc.. Inserts a line consisting of spaces at the cursor position when used in the sequence, SHIFT/LOC ESC, LINE INSERT. Deletes the character

WARNING: The equipment described in this document generates, uses, and can radiate radio frequency energy, and if not installed in accordance with instructions

The routine will respond by typing the contents of the location specified by the address just typed-in, and wait for another action by the operator.. The

for the user of this service or not, these questions will help you codify your thinking and formulate·a strategy to help insure success of your function and

COmmunications Management User's Guide binder for more specific information about remote access connections and setups using the optional AT&amp;T UNIX PC