Compiling a Language

Total Page:16

File Type:pdf, Size:1020Kb

Compiling a Language Universidade Federal de Minas Gerais – Department of Computer Science – Programming Languages Laboratory COMPILING A LANGUAGE DCC 888 Dealing with Programming Languages • LLVM gives developers many tools to interpret or compile a language: – The intermediate representaon – Lots of analyses and opDmiEaons Fhen is it worth designing a new • Fe can work on a language that already languageM exists, e.g., C, CKKI Lava, etc • Fe can design our own language. We need a front Machine independent Machine dependent end to convert optimizations, such as optimizations, such programs in the constant propagation as register allocation source language 2344555 to LLVM IR *+,-), 1#% ((0 !"#$%&'() '()./0 '()./0 '().- The Simple Calculator • To illustrate this capacity of LLAM, le2Ns design a very simple programming language: – A program is a funcDon applicaon – A funcDon contains only one argument x – Only the integer type exists – The funcDon body contains only addiDons, mulDplicaons, references to x, and integer constants in polish notaon: 1) Can you understand why we got each of these valuesM SR How is the grammar of our languageM The Architecture of Our Compiler !"#"$ %&$'"$ 2$34"$ (#)$ !!*05136' 1) Can you guess the meaning of the *&$(#)$ 0,1(#)$ diUerent arrowsM SR Can you guess the +,-(#)$ .//(#)$ role of each classM 3) Fhat would be a good execuDon mode for our systemM The Execuon Engine Our execuDon engine parses the expression, $> ./driver 4! converts it to a funcDon wriSen in LLAM IR, LIT * x x! Result: 16! compiles this funcDon, and runs it with the argument passed to the program in command $> ./driver 4! line. + x * x 2! Result: 12! Le2Ns start with our lexer. Which $> ./driver 4! ; ModuleID = NExampleN tokens do we * x + x 2! have? Result: 24! de]ne i32 @fun_i32 %xR*a* entry: %addtmp = add i32 %x, 2 %multmp = mul i32 %x, %addtmp ret i32 %multmp b* Lexer.h! The Lexer • A lexer is a program that divides a string of characters into tokens. – A token is a terminal in our grammar, e.g., cifndef LEdWR_H a symbol that is part of the alphabet of c(e]ne LEdWR_H our language. #include f'tringg* – Lexers can be easily implemented as class Lexer*a* ]nite automata. public: std::string getToken_R[ Lexer() : lastChar_N 'R*ab* private: 1) Again: which kind of char lastChar; tokens do we haveM inline char getNextChar_R*a* char c = lastChar; SR Can you guess the lastChar = getchar_R[ implementaon of the return c; getToken_R methodM } b[ cendif Lexer.cpp! Implementaon of the Lexer #include iLexer.hi* std::string Lexer::getToken_R*a* while (isspace_lastCharRR*a*lastChar = getchar_R[ } if (isalpha(lastCharRR*a* std::string idStr; do { idStr += getNextChar_R[ } while (isalnum_lastCharRR[ return idStr; } else if (isdigi2_lastCharRR*a* std::string numStr; do { numStr += getNextChar_R[ } while (isdigi2_lastCharRR[ return numStr; } else if (lastChar == EOFR a return ii; 1) Fould you be able to } else*a* represent this lexer as std::string operatorStr; a state machineM operatorStr = getNextChar_R[ return operatorStr; SR Fe must now de]ne } the parser. How can b* we implement i2M Parser.cpp! Parsing • Parsing is the act to transform a string of tokens in a syntax tree♤. cifndef PARSER_H 1) Fhat are these c(e]ne PARSER_H forward declaraons good forM #include f'tringg* class Expr; SR 0o you understand class Lexer; this syntaxM class Parser a 3) Fhat does the parser public: returnM Parser_Lexer* argLexer) : lexer_argLexerR*ab* Expr* parseExpr_R[ private: Lexer* lexer; b[ cendif ♤: it used to be one of the most important problems in computer science. Syntax Trees • The parser produces syntax trees. * x x + x * x 2 * x + x 2 * + * x x x * x + x 2 x 2 How can we implement these trees in CKKM Expr.h! The hodes of the Tree cifndef AST_H c(e]ne AST_H #include illvm/IR/IRBuilder.hi* class AddExpr : public Expr*a* class Expr*a* public: public: AddExpr(Expr* op1Arg, Expr* op2ArgR : op1(op1Arg), op2(op2Ar;R*ab* virtual mExpr_R*ab* virtual llvm::Aalue *gen_llvm::IRBuilderfg**builder, llvm::Aalue *gen_llvm::IRBuilderfg**builder, llvm::LLAMContextn conR const = o; llvm::LLAMContextn conR const; b[ private: const Expr* op1; const Expr* op2; class NumExpr : public Expr*a* public: b[ NumExpr(int arghum) : num_arghumR*ab* llvm::Aalue *gen_llvm::IRBuilderfg**builder, class MulExpr : public Expr*a* llvm::LLAMContextn conR const; public: MulExpr_Expr* op1Arg, Expr* op2ArgR : stac const unsigned int SYpEeYhT = 32; private: op1(op1Arg), op2(op2Ar;R*ab* const int num; llvm::Aalue *gen_llvm::IRBuilderfg**builder, b[ llvm::LLAMContextn conR const; private: const Expr* op1; class AarExpr : public Expr*a* const Expr* op2; public: There is a gen method llvm::Aalue *gen_llvm::IRBuilderfg**builder, b[ llvm::LLAMContextn conR const; that is a bit weird. Fe stac llvm::Aalue* varAalue; cendif shall look into it later. b[ .oing lack into the Parser • Our parser will build a syntax tree. + x * x 2 !"#$%# &%'()**+,-#. ((((&%'(/"#+,-.01 + ((((&%'(234+,-#. ((((((((&%'(/"#+,-#.01 ((((((((&%'(536+,-#.70 x * ((((0 0 x 2 The polish notaon really So, how can we simpli]es parsing. Fe implement our already have the tree, and parserM Lan rukasiewicEI father without parenthesesq of the Polish notaon Parser.cpp! The ParserNs Implementaon Expr* Parser::parseExpr_R*a* #include iExpr.hi* std::string tk = lexersggetToken_R[ #include iLexer.hi* if (tk == iiR a #include iParser.hi* return hULL; b else if _isdigi2_tktouRR a 1) Fhy checking the ]rst return new humExpr_atoi_tk.c_str_RRR[ character of each token is b else if _tktou == NxNR*a already enough to avoid any return new AarExpr_R[ ambiguityM b else if _tktou == NKNR a Expr *op1 = parseExpr_R[ SR how we need a way to Expr *op2 = parseExpr_R[ translate trees into LLAM IR. return new AddExpr_op1, op2R; How to do i2M b else if _tktou == NjNR a Expr *op1 = parseExpr_R[ !"#$%&'() '()156 "$; Expr *op2 = parseExpr_R[ <,!=), return new MulExpr_op1, op2R; } else*a* *+,-), ./#,12)"34 7#% 89: return hULL; } ./#,0 '()17#%1- b* Expr.cpp! The Translator #include iExpr.hi* Our implementaon has a llvm::Aalue* AarExpr::varAalue = hULL; small hack: our language llvm::Aalue* NumExpr::gen has only one variable, which _llvm::IRBuilderfg**builder, llvm::LLAMContext ncontext) const a we have decided to call Nx'. return llvm::ConstantInt::get This variable must be _llvm::Type::getInt32Ty_context), numR; represented by an LLAM b* value, which is the llvm::Aalue* AarExpr::gen _llvm::IRBuilderfg**builder, llvm::LLAMContext ncontext) const a argument of the funcDon llvm::Aalue* var = AarExpr::varAalue; that we will create. Thus, return var ? var : NULL; we need a way to inform b* the translator this value. Fe llvm::Aalue* AddExpr::gen do it through a stac _llvm::IRBuilderfg**builder, llvm::LLAMContext ncontext) const a llvm::Aalue* v1 = op1sggen_builder, context); variable varValue. That is llvm::Aalue* v2 = op2sggen_builder, context); the only stac variable that return buildersg6reateAdd_v1, v2, iaddtmpiR[* we are using in this class. b* llvm::Aalue* MulExpr::gen _llvm::IRBuilderfg**builder, llvm::LLAMContext ncontext) const a llvm::Aalue* v1 = op1sggen_builder, context); llvm::Aalue* v2 = op2sggen_builder, context); return buildersg6reateMul_v1, v2, imultmpiR[* b* Driver.cpp! The DriverNs Skeleton int main_int argc, char** argvR*a* The procedure if (argc q= 2R a that creates an llvm::errs_R ff*iInform an argument to your expression.vni[* LLAM funcDon is return 1; not that } else*a* complicated. Can llvm::LLAMContext context; you guess its llvm::Module *module = new llvm::Module_iExamplei, context); implementaonM llvm::Funcon *funcDon = createEntryFuncHon(module, context); modulesg(ump_R; llvm::ExecuonEngine* engine = createEngine(moduleR[ LIT_engine, funcDon, atoi_argvt1uRR; } b* !"#$%&'() '()156 "$; <,!=), *+,-), ./#,12)"34 7#% 89: ./#,0 '()17#%1- Driver.cpp! Creang an LLAM FuncDon llvm::Funcon *createEntryFuncDon( This code is not itha2i complicated, but it llvm::Module *module, is not super straighworward either, so we llvm::LLAMContext ncontext) a will go a bit more carefully over it. llvm::FuncHon *funcHon = llvm::castDllvm::FuncHonEF modul4HE1etOrInsertFuncHonFIfunIJ llvm::Type::1etInt32TyFcontextP, llvm::Type::getInt32TyFcontext), (llvm::Type *)0P ); llvm::lasicllock *bb = llvm::lasicllock::Create_context, ientryi, funcDonR; llvm::IRBuilderfg*builder(contextR[ builder.SetInsertPoin2_bbR[ llvm::Argument *argd*= funcDonsgarg_begin_R[ Le2Ns start with argdsgsetName_ixiR[* this humongous AarExpr::varAalue = argd; call. Fhat do you Lexer lexer; think it is doingM Parser parser_nlexerR[ Expr* expr = parser.parseExpr_R[ llvm::Aalue* re2Aal = exprsggen_nbuilder, context); builder.CreateRe2_re2AalR[ return funcDon; b* Driver.cpp! Creang an LLAM FuncDon llvm::Funcon *createEntryFuncDon( llvm::Module *module, llvm::LLAMContext ncontext) a llvm::Funcon *funcDon = llvm::castfllvm::Funcong_ modulesggetOrInsertFuncDon_ifuni, llvm::Type::getInt32Ty_context), llvm::Type::getInt32Ty_context), _llvm::Type jRoR ); llvm::BasicBlock *bb = llvm::BasicBlock::CreateFconteOt, "entry", funcHon); llvm::IRBuilderDE#builder(conteOt); builder.SetInsertPoint(bb); Here we are creang a funcDon llvm::Argument *argd*= funcDonsgarg_begin_R[ called ifuni that returns an argdsgsetName_ixiR[* integer, and receives an integer AarExpr::varAalue = argd; as a parameter. This cast has a And here, what Lexer lexer; variable number of arguments, are we doingM Parser parser_nlexerR[ and so we use a senDnel, e.g., Expr* expr = parser.parseExpr_R[ hULL, to indicate the end of llvm::Aalue* re2Aal = exprsggen_nbuilder, context);
Recommended publications
  • DC Console Using DC Console Application Design Software
    DC Console Using DC Console Application Design Software DC Console is easy-to-use, application design software developed specifically to work in conjunction with AML’s DC Suite. Create. Distribute. Collect. Every LDX10 handheld computer comes with DC Suite, which includes seven (7) pre-developed applications for common data collection tasks. Now LDX10 users can use DC Console to modify these applications, or create their own from scratch. AML 800.648.4452 Made in USA www.amltd.com Introduction This document briefly covers how to use DC Console and the features and settings. Be sure to read this document in its entirety before attempting to use AML’s DC Console with a DC Suite compatible device. What is the difference between an “App” and a “Suite”? “Apps” are single applications running on the device used to collect and store data. In most cases, multiple apps would be utilized to handle various operations. For example, the ‘Item_Quantity’ app is one of the most widely used apps and the most direct means to take a basic inventory count, it produces a data file showing what items are in stock, the relative quantities, and requires minimal input from the mobile worker(s). Other operations will require additional input, for example, if you also need to know the specific location for each item in inventory, the ‘Item_Lot_Quantity’ app would be a better fit. Apps can be used in a variety of ways and provide the LDX10 the flexibility to handle virtually any data collection operation. “Suite” files are simply collections of individual apps. Suite files allow you to easily manage and edit multiple apps from within a single ‘store-house’ file and provide an effortless means for device deployment.
    [Show full text]
  • Process and Memory Management Commands
    Process and Memory Management Commands This chapter describes the Cisco IOS XR software commands used to manage processes and memory. For more information about using the process and memory management commands to perform troubleshooting tasks, see Cisco ASR 9000 Series Aggregation Services Router Getting Started Guide. • clear context, on page 2 • dumpcore, on page 3 • exception coresize, on page 6 • exception filepath, on page 8 • exception pakmem, on page 12 • exception sparse, on page 14 • exception sprsize, on page 16 • follow, on page 18 • monitor threads, on page 25 • process, on page 29 • process core, on page 32 • process mandatory, on page 34 • show context, on page 36 • show dll, on page 39 • show exception, on page 42 • show memory, on page 44 • show memory compare, on page 47 • show memory heap, on page 50 • show processes, on page 54 Process and Memory Management Commands 1 Process and Memory Management Commands clear context clear context To clear core dump context information, use the clear context command in the appropriate mode. clear context location {node-id | all} Syntax Description location{node-id | all} (Optional) Clears core dump context information for a specified node. The node-id argument is expressed in the rack/slot/module notation. Use the all keyword to indicate all nodes. Command Default No default behavior or values Command Modes Administration EXEC EXEC mode Command History Release Modification Release 3.7.2 This command was introduced. Release 3.9.0 No modification. Usage Guidelines To use this command, you must be in a user group associated with a task group that includes appropriate task IDs.
    [Show full text]
  • The Ifplatform Package
    The ifplatform package Original code by Johannes Große Package by Will Robertson http://github.com/wspr/ifplatform v0.4a∗ 2017/10/13 1 Main features and usage This package provides the three following conditionals to test which operating system is being used to run TEX: \ifwindows \iflinux \ifmacosx \ifcygwin If you only wish to detect \ifwindows, then it does not matter how you load this package. Note then that use of (Linux or Mac OS X or Cygwin) can then be detected with \ifwindows\else. If you also wish to determine the difference between which Unix-variant you are using (i.e., also detect \iflinux, \ifmacosx, and \ifcygwin) then shell escape must be enabled. This is achieved by using the -shell-escape command line option when executing LATEX. If shell escape is not enabled, \iflinux, \ifmacosx, and \ifcygwin will all return false. A warning will be printed in the console output to remind you in this case. ∗Thanks to Ken Brown, Joseph Wright, Zebb Prime, and others for testing this package. 1 2 Auxiliary features \ifshellescape is provided as a conditional to test whether shell escape is active or not. (Note: new versions of pdfTEX allow you to query shell escape with \ifnum\pdfshellescape>0 , and the pdftexcmds package provides the wrapper \pdf@shellescape which works with X TE EX, pdfTEX, and LuaTEX.) Also, the \platformname command is defined to expand to a macro that represents the operating system. Default definitions are (respectively): \windowsname ! ‘Windows’ \notwindowsname ! ‘*NIX’ (when shell escape is disabled) \linuxname ! ‘Linux’ \macosxname ! ‘Mac OS X’ \cygwinname ! ‘Cygwin’ \unknownplatform ! whatever is returned by uname E.g., if \ifwindows is true then \platformname expands to \windowsname, which expands to ‘Windows’.
    [Show full text]
  • How to Dump and Load
    How To Dump And Load Sometimes it becomes necessary to reorganize the data in your database (for example, to move data from type i data areas to type ii data areas so you can take advantage of the latest features)or to move parts of it from one database to another. The process for doping this can be quite simple or quite complex, depending on your environment, the size of your database, what features you are using, and how much time you have. Will you remember to recreate the accounts for SQL users? To resotre theie privileges? Will your loaded database be using the proper character set and collations? What about JTA? Replication? etc. We will show you how to do all the other things you need to do in addition to just dumping and loading the data in your tables. 1 How To Dump and Load gus bjorklund head groundskeeper, parmington foundation 2 What do we mean by dumping and loading? • Extract all the data from a database (or storage area) • Insert the data into a new database (or storage area) • Could be entire database or part 3 Why do we dump and load? 4 Why do we dump & load? • To migrate between platforms • To upgrade OpenEdge to new version • To repair corruption • To “improve performance” • To change storage area configuration • To defragment or improve “scatter” • To fix a “long rm chain” problem • Because it is October 5 Ways to dump and load • Dictionary • 4GL BUFFER-COPY • Binary • Replication triggers (or CDC) • Table partitioning / 4GL • Incremental by storage area 6 Binary Dump & Load • binary dump files – not "human readable"
    [Show full text]
  • Sqlite Dump Without Schema
    Sqlite Dump Without Schema Rodrick unpeopling thermochemically? Autogamous and burst Emanuel check almost hurry-scurry, though Andre inundated his hominidae request. Rident Cobbie electrocuted very huskily while Chandler remains low-key and sickly. The functions are many popular formats, without sqlite schema dump tables in a good chance of sql will generate text file with up your db clear and create table You who check created tables by following commands fist in command line circuit in SQLite command line sqlite3 gamadb sqlite tables Output. To format the world with sqlite tutorial, without sqlite dump schema and are now i thought i increase the. The database schema in an SQLite database is stored ina special table. Using SQLite MoonPoint Support. Application successfully installed devices without going to dump file called. Sqlite3 mysqlitefiledb sqlite output pathtomyoutputfilesql. How To porter The SQLite Dump Command SQLite Tutorial. Impexpc File Reference ch-wernerde. Sqlite commands before it was able to any given json, without sqlite dump file size is how can execute sql? Convert SQLite database to Postgres database like Science. Whenever the without sqlite schema dump command line consists of the table in the support is the last row in list is highly complex peewee. Ram that schema dump command without actually finding and. Trying to know when concatenating character types are dumped db clear, break if start of. Schema Generator MikroORM. Can also crumb the following command which restrict output the file directly. MySQL How you dump a MySQL database and export schema. SQLite Jason L Froebe Tech tips and How Tos for Fellow.
    [Show full text]
  • A First Course to Openfoam
    Basic Shell Scripting Slides from Wei Feinstein HPC User Services LSU HPC & LON [email protected] September 2018 Outline • Introduction to Linux Shell • Shell Scripting Basics • Variables/Special Characters • Arithmetic Operations • Arrays • Beyond Basic Shell Scripting – Flow Control – Functions • Advanced Text Processing Commands (grep, sed, awk) Basic Shell Scripting 2 Linux System Architecture Basic Shell Scripting 3 Linux Shell What is a Shell ▪ An application running on top of the kernel and provides a command line interface to the system ▪ Process user’s commands, gather input from user and execute programs ▪ Types of shell with varied features o sh o csh o ksh o bash o tcsh Basic Shell Scripting 4 Shell Comparison Software sh csh ksh bash tcsh Programming language y y y y y Shell variables y y y y y Command alias n y y y y Command history n y y y y Filename autocompletion n y* y* y y Command line editing n n y* y y Job control n y y y y *: not by default http://www.cis.rit.edu/class/simg211/unixintro/Shell.html Basic Shell Scripting 5 What can you do with a shell? ▪ Check the current shell ▪ echo $SHELL ▪ List available shells on the system ▪ cat /etc/shells ▪ Change to another shell ▪ csh ▪ Date ▪ date ▪ wget: get online files ▪ wget https://ftp.gnu.org/gnu/gcc/gcc-7.1.0/gcc-7.1.0.tar.gz ▪ Compile and run applications ▪ gcc hello.c –o hello ▪ ./hello ▪ What we need to learn today? o Automation of an entire script of commands! o Use the shell script to run jobs – Write job scripts Basic Shell Scripting 6 Shell Scripting ▪ Script: a program written for a software environment to automate execution of tasks ▪ A series of shell commands put together in a file ▪ When the script is executed, those commands will be executed one line at a time automatically ▪ Shell script is interpreted, not compiled.
    [Show full text]
  • Linking + Libraries
    LinkingLinking ● Last stage in building a program PRE- COMPILATION ASSEMBLY LINKING PROCESSING ● Combining separate code into one executable ● Linking done by the Linker ● ld in Unix ● a.k.a. “link-editor” or “loader” ● Often transparent (gcc can do it all for you) 1 LinkingLinking involves...involves... ● Combining several object modules (the .o files corresponding to .c files) into one file ● Resolving external references to variables and functions ● Producing an executable file (if no errors) file1.c file1.o file2.c gcc file2.o Linker Executable fileN.c fileN.o Header files External references 2 LinkingLinking withwith ExternalExternal ReferencesReferences file1.c file2.c int count; #include <stdio.h> void display(void); Compiler extern int count; int main(void) void display(void) { file1.o file2.o { count = 10; with placeholders printf(“%d”,count); display(); } return 0; Linker } ● file1.o has placeholder for display() ● file2.o has placeholder for count ● object modules are relocatable ● addresses are relative offsets from top of file 3 LibrariesLibraries ● Definition: ● a file containing functions that can be referenced externally by a C program ● Purpose: ● easy access to functions used repeatedly ● promote code modularity and re-use ● reduce source and executable file size 4 LibrariesLibraries ● Static (Archive) ● libname.a on Unix; name.lib on DOS/Windows ● Only modules with referenced code linked when compiling ● unlike .o files ● Linker copies function from library into executable file ● Update to library requires recompiling program 5 LibrariesLibraries ● Dynamic (Shared Object or Dynamic Link Library) ● libname.so on Unix; name.dll on DOS/Windows ● Referenced code not copied into executable ● Loaded in memory at run time ● Smaller executable size ● Can update library without recompiling program ● Drawback: slightly slower program startup 6 LibrariesLibraries ● Linking a static library libpepsi.a /* crave source file */ … gcc ..
    [Show full text]
  • “Log” File in Stata
    Updated July 2018 Creating a “Log” File in Stata This set of notes describes how to create a log file within the computer program Stata. It assumes that you have set Stata up on your computer (see the “Getting Started with Stata” handout), and that you have read in the set of data that you want to analyze (see the “Reading in Stata Format (.dta) Data Files” handout). A log file records all your Stata commands and output in a given session, with the exception of graphs. It is usually wise to retain a copy of the work that you’ve done on a given project, to refer to while you are writing up your findings, or later on when you are revising a paper. A log file is a separate file that has either a “.log” or “.smcl” extension. Saving the log as a .smcl file (“Stata Markup and Control Language file”) keeps the formatting from the Results window. It is recommended to save the log as a .log file. Although saving it as a .log file removes the formatting and saves the output in plain text format, it can be opened in most text editing programs. A .smcl file can only be opened in Stata. To create a log file: You may create a log file by typing log using ”filepath & filename” in the Stata Command box. On a PC: If one wanted to save a log file (.log) for a set of analyses on hard disk C:, in the folder “LOGS”, one would type log using "C:\LOGS\analysis_log.log" On a Mac: If one wanted to save a log file (.log) for a set of analyses in user1’s folder on the hard drive, in the folder “logs”, one would type log using "/Users/user1/logs/analysis_log.log" If you would like to replace an existing log file with a newer version add “replace” after the file name (Note: PC file path) log using "C:\LOGS\analysis_log.log", replace Alternately, you can use the menu: click on File, then on Log, then on Begin.
    [Show full text]
  • Epmp Command Line Interface User Guide
    USER GUIDE ePMP Command Line Interface ePMP Command Line Interface User Manual Table of Contents 1 Introduction ...................................................................................................................................... 3 1.1 Purpose ................................................................................................................................ 3 1.2 Command Line Access ........................................................................................................ 3 1.3 Command usage syntax ...................................................................................................... 3 1.4 Basic information ................................................................................................................. 3 1.4.1 Context sensitive help .......................................................................................................... 3 1.4.2 Auto-completion ................................................................................................................... 3 1.4.3 Movement keys .................................................................................................................... 3 1.4.4 Deletion keys ....................................................................................................................... 4 1.4.5 Escape sequences .............................................................................................................. 4 2 Command Line Interface Overview ..............................................................................................
    [Show full text]
  • Powerview Command Reference
    PowerView Command Reference TRACE32 Online Help TRACE32 Directory TRACE32 Index TRACE32 Documents ...................................................................................................................... PowerView User Interface ............................................................................................................ PowerView Command Reference .............................................................................................1 History ...................................................................................................................................... 12 ABORT ...................................................................................................................................... 13 ABORT Abort driver program 13 AREA ........................................................................................................................................ 14 AREA Message windows 14 AREA.CLEAR Clear area 15 AREA.CLOSE Close output file 15 AREA.Create Create or modify message area 16 AREA.Delete Delete message area 17 AREA.List Display a detailed list off all message areas 18 AREA.OPEN Open output file 20 AREA.PIPE Redirect area to stdout 21 AREA.RESet Reset areas 21 AREA.SAVE Save AREA window contents to file 21 AREA.Select Select area 22 AREA.STDERR Redirect area to stderr 23 AREA.STDOUT Redirect area to stdout 23 AREA.view Display message area in AREA window 24 AutoSTOre ..............................................................................................................................
    [Show full text]
  • 21Files2.Pdf
    Here is a portion of a Unix directory tree. The ovals represent files, the rectangles represent directories (which are really just special cases of files). A simple implementation of a directory consists of an array of pairs of component name and inode number, where the latter identifies the target file’s inode to the operating system (an inode is data structure maintained by the operating system that represents a file). Note that every directory contains two special entries, “.” and “..”. The former refers to the directory itself, the latter to the directory’s parent (in the case of the slide, the directory is the root directory and has no parent, thus its “..” entry is a special case that refers to the directory itself). While this implementation of a directory was used in early file systems for Unix, it suffers from a number of practical problems (for example, it doesn’t scale well for large directories). It provides a good model for the semantics of directory operations, but directory implementations on modern systems are more complicated than this (and are beyond the scope of this course). Here are two directory entries referring to the same file. This is done, via the shell, through the ln command which creates a (hard) link to its first argument, giving it the name specified by its second argument. The shell’s “ln” command is implemented using the link system call. Here are the (abbreviated) contents of both the root (/) and /etc directories, showing how /unix and /etc/image are the same file. Note that if the directory entry /unix is deleted (via the shell’s “rm” command), the file (represented by inode 117) continues to exist, since there is still a directory entry referring to it.
    [Show full text]
  • Section “Common Predefined Macros” in the C Preprocessor
    The C Preprocessor For gcc version 12.0.0 (pre-release) (GCC) Richard M. Stallman, Zachary Weinberg Copyright c 1987-2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation. A copy of the license is included in the section entitled \GNU Free Documentation License". This manual contains no Invariant Sections. The Front-Cover Texts are (a) (see below), and the Back-Cover Texts are (b) (see below). (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. i Table of Contents 1 Overview :::::::::::::::::::::::::::::::::::::::: 1 1.1 Character sets:::::::::::::::::::::::::::::::::::::::::::::::::: 1 1.2 Initial processing ::::::::::::::::::::::::::::::::::::::::::::::: 2 1.3 Tokenization ::::::::::::::::::::::::::::::::::::::::::::::::::: 4 1.4 The preprocessing language :::::::::::::::::::::::::::::::::::: 6 2 Header Files::::::::::::::::::::::::::::::::::::: 7 2.1 Include Syntax ::::::::::::::::::::::::::::::::::::::::::::::::: 7 2.2 Include Operation :::::::::::::::::::::::::::::::::::::::::::::: 8 2.3 Search Path :::::::::::::::::::::::::::::::::::::::::::::::::::: 9 2.4 Once-Only Headers::::::::::::::::::::::::::::::::::::::::::::: 9 2.5 Alternatives to Wrapper #ifndef ::::::::::::::::::::::::::::::
    [Show full text]