Pre-Compiler Directives for TTCN-3 Ina Schieferdecker in response to CR5089 and 5090.

Slides:



Advertisements
Similar presentations
THE PREPROCESSOR. Preprocessing is (apparently) done before actual compilation begins. The preprocessor doesnt know (very much) C. Major kinds of preprocessor.
Advertisements

Compilation and Debugging 101. Compilation in C/C++ hello.c Preprocessor Compiler stdio.h tmpXQ.i (C code) hello.o (object file)
Files in C Rohit Khokher.
Programming III SPRING 2015 School of Computer and Information Sciences Francisco R. Ortega, Ph.D. McKnight Fellow and GAANN Fellow LECTURE #3 Control.
CSc 352 An Introduction to the C Preprocessor Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 17 - The Preprocessor Outline 17.1Introduction 17.2The #include Preprocessor Directive 17.3The.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction.
Programming C/C++ on Eclipe Trình bày: Ths HungNM C/C++ Training.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
1 CSE 303 Lecture 13b The C preprocessor reading: Programming in C Ch. 13 slides created by Marty Stepp
The Preprocessor #include #define N 10 C program Preprocessor Modified C program Preprocessor Object codes.
C How to Program, 6/e © by Pearson Education, Inc. All Rights Reserved.
 2007 Pearson Education, Inc. All rights reserved C Preprocessor.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 19 - The Preprocessor Outline 19.1 Introduction 19.2 The #include Preprocessor Directive 19.3.
CS 161 Introduction to Programming and Problem Solving Chapter 13 C++ Preprocessor Herbert G. Mayer, PSU Status 10/8/2014 Initial content copied verbatim.
The preprocessor and the compilation process COP3275 – PROGRAMMING USING C DIEGO J. RIVERA-GUTIERREZ.
CMPE-013/L: “C” Programming Gabriel Hugh Elkaim – Spring 2013 CMPE-013/L Pre-Processor Commands Gabriel Hugh Elkaim Spring 2013.
1 CSC103: Introduction to Computer and Programming Lecture No 26.
Windows Programming Lecture 05. Preprocessor Preprocessor Directives Preprocessor directives are instructions for compiler.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 12 - The Preprocessor Directives (Macros)
Macros. There are three basic phases for C programming. preprocessing, compiling, and linking. C input file is first passed to a preprocessing program.
The Structure of a C++ Program. Outline 1. Separate Compilation 2. The # Preprocessor 3. Declarations and Definitions 4. Organizing Decls & Defs into.
1 Homework / Exam Finish up K&R Chapters 3 & 4 Starting K&R Chapter 5 Next Class HW4 due next class Go over HW3 solutions.
Chapter 13 C Preprocessor C How to Program, 8/e ©2016 by Pearson Education, Inc., Hoboken, NJ. All Rights Reserved.
C Hints and Tips The preprocessor and other fun toys.
Engineering Computing I Chapter 4 Functions and Program Structure.
L function n predefined, programmer-defined l arguments, (formal) parameters l return value l function call, function invocation l function definition.
1 Preprocessor –How it works File Inclusion: #include Macro Definition: #define Predefined macros –__LINE__, __FILE__, __DATE__, __TIME__ Conditional Compilation.
C How to Program, 7/e © by Pearson Education, Inc. All Rights Reserved.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessing Lecture 12 April 7, 2005.
Week 2-3 Control flow (review) Conditional statements If, else, else if, switch-case, break Loop constructs for, while, do-while, break, continue, label--go;
Dr. Mark L. HornickCS-1030 Dr. Mark Hornick 1 C++ Global functions Declarations & Definitions Preprocessor Directives.
C Programming Day 3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Storage Class Specifiers Every variable in a C.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessor Midterm Review Lecture 7 Feb 17, 2004.
Compiler Directives. The C Preprocessor u The C preprocessor (cpp) changes your source code based on instructions, or preprocessor directives, embedded.
THE PREPROCESSOR
The Preprocessor Directives Introduction Preprocessing – Occurs before program compiled Inclusion of external files Definition of symbolic constants.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
© Oxford University Press All rights reserved. CHAPTER 10 THE PREPROCESSOR DIRECTIVE.
1 Object-Oriented Programming -- Using C++ Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
Adv. UNIX:pre/111 Advanced UNIX v Objectives of these slides: –look at the features of the C preprocessor Special Topics in Comp. Eng.
C PREPROCESSOR. Introduction  It is a program that processes our source program before it is passed to the compiler.  Preprocessor commands (often known.
C language + The Preprocessor. + Introduction The preprocessor is a program that processes that source code before it passes through the compiler. It.
Version 1.0 C#.Net Software Development. Overview Namespaces using Statement Pre-Processor Directives 2Copyright © by Dennis A. Fairclough all.
COM S 326X Deep C Programming for the 21st Century Prof. Rozier
13 C Preprocessor.
Week 3-4 Control flow (review) Function definition Program Structures
What Is? function predefined, programmer-defined
CISC105 – General Computer Science
INC 161 , CPE 100 Computer Programming
Namespaces & Preprocessor
Chapter 13 - The Preprocessor
14. THE PREPROCESSOR.
Pre-processor Directives
Introduction to Programming
Preprocessor C program → Modified C program → Object Code
Register Variables Declaring a variable as a "register" variable is an advisory to the compiler to keep the normal location of the variable in a register,
C Preprocessor(CPP).
Preprocessor.
Programming in C Miscellaneous Topics.
CSc 352 An Introduction to the C Preprocessor
C Preprocessor Seema Chandak.
C Programming Language
Chapter 11: The Preprocessor
What Is? function predefined, programmer-defined
CSE 341 Lecture 22 Macros; extending Scheme's syntax
Conditional Compilation
Week 2 - Friday CS222.
Preprocessor Directives and Macros Chapter 21
Presentation transcript:

Pre-Compiler Directives for TTCN-3 Ina Schieferdecker in response to CR5089 and 5090

Directives in C# C# has conditional compilation symbols which can be used to affect compilation. These can be defined within code or with parameters to the compiler. The "pre-processing" directives in C# (named solely for consistency with C/C++, despite there being no separate pre- processing step) are (text taken from the ECMA specification): #define and #undef –Used to define and undefine conditional compilation symbols #if, #elif, #else and #endif –Used to conditionally skip sections of source code #line –Used to control line numbers emitted for errors and warnings. #error and #warning –Used to issue errors and warnings. #region and #endregion –Used to explicitly mark sections of source code.

No Directives in Java conditional compilation can be realized by public static final variables in if statements (based on the control flow analysis done by Java) also no include – import is to be used instead

Limited Directives in Standard ML conditional compilation can be realized by functors with boolean arguments, however, compilers do not necessarily support conditional compilation include in ML basis file that lists the SML source files that make up a project or a library – SML has no import however

Limited Directives in Prolog ISO Prolog defines no way for program transformations such as macro expansion or conditional compilation There is a Prolog directive for file inclusion, but no import

Directives in Erlang Erlang preprocessor supports file inclusion, macros, and conditional compilation File inclusion (Erlang has no import) –include(File) –include_lib(File) Macro definition: –define(Const, Replacement) –define(Func(Var1,...,VarN), Replacement). Flow control: –undef(Macro) Causes the macro to behave as if it had never been defined. –ifdef(Macro) Evaluate the following lines only if Macro is defined. –ifndef(Macro) Evaluate the following lines only if Macro is not defined. –else Only allowed after an ifdef or ifndef directive. If that condition was false, the lines following else are evaluated instead. –endif Specifies the end of an ifdef or ifndef directive.

My Thoughts The addition of –#def, #undef –#if, #elif, #else, #endif could be a valuable extension for TTCN-3 e.g. in relation to conditional import support of several TTCN-3 releases in one module support of different TSIs in a test suite debugging If added, we should also enable the logging/stringification of macros