Diploma Thesis

Total Page:16

File Type:pdf, Size:1020Kb

Diploma Thesis Faculty of Computer Science Chair for Real Time Systems Diploma Thesis Porting DotGNU to Embedded Linux Author: Alexander Stein Supervisor: Jun.-Prof. Dr.-Ing. Robert Baumgartl Dipl.-Ing. Ronald Sieber Date of Submission: May 15, 2008 Alexander Stein Porting DotGNU to Embedded Linux Diploma Thesis, Chemnitz University of Technology, 2008 Abstract Programming PLC systems is limited by the provided libraries. In contrary, hardware-near programming needs bigger eorts in e. g. initializing the hardware. This work oers a foundation to combine advantages of both development sides. Therefore, Portable.NET from the DotGNU project has been used, which is an im- plementation of CLI, better known as .NET. The target system is the PLCcore- 5484 microcontroller board, developed by SYS TEC electronic GmbH. Built upon the porting, two variants to use interrupt routines withing the Portabe.NET runtime environment have been analyzed. Finally, the reaction times to occuring interrupt events have been examined and compared. Die Programmierung für SPS-Systeme ist durch die gegebenen Bibliotheken beschränkt, während hardwarenahe Programmierung einen gröÿeren Aufwand durch z.B. Initialisierungen hat. Diese Arbeit bietet eine Grundlage, um die Vorteile bei- der Entwicklungsseiten zu kombinieren. Dafür wurde Portable.NET des DotGNU- Projekts, eine Implementierung des CLI, bekannter unter dem Namen .NET, be- nutzt. Das Zielsystem ist das PLCcore-5484 Mikrocontrollerboard der SYS TEC electronic GmbH. Aufbauend auf der Portierung wurden zwei Varianten zur Ein- bindung von Interrupt-Routinen in die Portable.NET Laufzeitumgebung untersucht. Abschlieÿend wurden die Reaktionszeiten zu eintretenden Interrupts analysiert und verglichen. Acknowledgements I would like to thank some persons who had inuence and supported me in my work. At rst, I want to thank my supervisors, Jun.-Prof. Dr.-Ing. Robert Baumgartl and Dipl.-Ing. Ronald Sieber, who passed many valuable comments to me. I am grateful to SYS TEC electronic GmbH for making this diploma thesis possible. Special thanks go to the developers of Portable.NET, who helped me to understand the internals of the program and to nd solutions for problems that occured in the course of my work. Last but not least, I want to thank my familiy that supported me in their special manner. Without their support, my study would not have been possible this way. Contents List of Tables iv List of Figures v Listings vi 1 Introduction 1 1.1 Objective . 1 1.2 Structure . 2 2 State of the Art 3 2.1 .NET Framework . 3 2.1.1 Common Language Runtime . 4 2.1.2 Common Type System . 6 2.1.3 Common Language Specication . 6 2.1.4 Common Intermediate Language . 7 2.1.5 Metadata . 8 2.1.6 .NET Class Library . 8 2.2 DotGNU . 9 2.2.1 Hans-Boehm Garbage Collector . 10 2.2.2 Foreign Function Interface . 11 2.2.3 Interpreter . 11 2.2.4 Unrolled Assembler Code . 12 2.2.5 JIT Support . 13 2.2.6 Debugging . 14 2.2.7 X11 Support . 16 2.2.8 Embedded Engine . 16 2.3 Mono . 17 i Contents 2.4 Rotor . 17 2.5 Coldre vs. m68k . 17 2.5.1 Exclusive Instructions . 18 2.5.2 Floating Point Size . 18 2.5.3 Other Dierences . 19 2.5.4 ABI Changes . 19 3 Implementation 20 3.1 Incompatible m68k Code . 20 3.2 Incompatible Alignments . 21 3.3 Broken Toolchain . 24 3.4 Unrolling Assembler Code . 24 3.4.1 Setup of the Unroller . 25 3.4.2 Unroller Implementation . 26 3.4.3 m68k Specics . 27 3.4.4 Macro Counting . 28 3.4.5 Extended Testsuite . 29 3.4.6 Floating Point Remainder . 34 3.4.7 Big Endianess . 34 3.4.8 NOP is not just no Operation . 35 3.4.9 Caches . 36 3.5 C# Debugging . 37 3.6 Interrupt Access in C# . 38 3.6.1 Kernel Module . 39 3.6.2 C# Application . 40 3.7 Results . 42 4 Performance 43 4.1 Portable.NET Benchmark . 43 4.2 Benchmark Results . 44 4.3 Interrupt Response Time . 46 5 Final Remarks and Further Work 53 5.1 Conclusion . 53 5.2 Improvements . 53 ii Contents 5.2.1 Increasing Engine Performance . 53 5.2.2 Tweaking IRQ Handling . 54 5.2.3 Porting JIT to MCF5484 . 55 5.2.4 Miscellaneous . 55 6 Acronyms 56 Bibliography 58 A Contents of the enclosed CD 61 iii List of Tables 2.1 New Instructions introduced on Coldre . 18 3.1 List of mentioned assembler instructions in this chapter . 22 4.1 Results from pnetmark for the dierent engines . 45 4.2 Comparisons to the interpreter engines . 50 iv List of Figures 2.1 Reduced compiler-ISA-combinations, adopted from [1] . 5 2.2 Relationship between CLS and CTS, adopted from [1] . 7 2.3 Development using pnet, adopted from [11] . 14 2.4 Debug Communication in Portable .NET . 15 3.1 IRQ access setup . 41 4.1 IRQ timings at 100 Hz rate . 48 4.2 IRQ timings at 10 Hz rate . 49 4.3 IRQ timings at 1 Hz rate . 50 4.4 IRQ timings at 0.1 Hz rate . 51 v Listings 3.1 Test and Set for m68k (adopted from pnet) . 20 3.2 Testcode for missing load_memindex macros . 31 3.3 Testcode for missing oating point macros . 31 3.4 Testcode for missing unsigned div instruction . 32 vi 1 Introduction SYS TEC electronic GmbH1 has developed a microcontroller board named PLCcore- 5484, which is based on the 32-bit Freescale MCF5484 microcontroller. This Programmable Logic Controller (PLC) core module is used industrially for the au- tomation of processes. Programming PLCs is limited by the system libraries, which are provided by the manufacturer. Thus, it is not possible to access hardware components or to react directly on interrupt events, unlike embedded programming using C or Assembler. However, it is desirable to combine the advantages like comfort of PLC programming and the exibility of hardware-near programming. Additionally, disadvantages of either sides should be eliminated, e. g. explicit hardware initializing in hardware- near programming or restricted type casts in PLC programs. 1.1 Objective This work shall build the foundation to make the above mentioned features possible. Therefore, a .NET runtime, actually the opensource implementation DotGNU, is used. DotGNU is suitable for the embedded Linux in PLCcore-5484, because it allows the wanted exibility and hardware access, which is required for realizing real time systems. Furthermore, this runtime also provides a class library for abstraction and encapsulation of details, like it is commonly used in PLC programming. Porting DotGNU to the MCF5484 microcontroller has to be done at rst. Afterwards, the possibilities of interrupt routine usage have to be analyzed and implemented. 1http://www.systec-electronic.com 1 1 Introduction 1.2 Structure The diploma thesis is divided into ve chapters. The rst section, the introduction, explains the backgrounds and objectives of this work. State of the art, the second chapter, outlines technologies and architectures related to the porting of DotGNU to embedded Linux. The next chapter, the implementation, describes the actual porting, as well as encountered problems and their solutions. This part also includes the realization of interrupt access inside DotGNU and the results of the entire im- plementation. The second last chapter contains information about performance of the runtime engine and response times from external interrupts. The nal chapter summarizes this paper and states ideas for further work. 2 2 State of the Art 2.1 .NET Framework This section gives an overview about .NET and its features. For more information about this framework [8], [1], [19], [17] and [11] are recommended. .NET is a programming platform developed by Microsoft. It is designed indepen- dently of the platform and operating system and standardized as ECMA international standard 335, which became accepted as an ISO standard later. The ocial name is Common Language Interface (CLI). Generally, it is possible to write every program using the .NET framework, but this does not hold true for drivers. The large programming library makes it easier to create an application, but in most cases it is just a wrapper for the Win32 API. There is also support for commonly used technologies and protocols, e. g. HTTP, XML, SOAP. This provides a unied set of features on every computer using a specic version of the .NET. So, all applications have the same features in the runtime like code checking, threading, garbage collection and exception handling. It is designed to be robust and secure. There are two dierent security models: Role- Based Security and Code Access Security. The rst one is the typical setup: several roles are dened, which have a dierent set of rights to access ressources on the running system. A program executed by a user automatically gets all the rights the user has. Using the second method, the rights granted that way may also be reduced. The security manager maps the security policy and the evidence (e. g. source, author) of the running assembly into a permission set assigned to the assembly. Accessing a ressource is restricted by a permission object, which checks the permission set of the assembly, if access is allowed. This is done for all assemblies in the current calling stack and for the actual access. The rights do not have to be restricted by 3 2 State of the Art any assembly. Combined with signed assemblies, an assembly replacement may be noticed, which could deny access for malicious code. The installation is easier than before as a program can be installed by copying the necessary les to the wanted directory. Consequentially, the deinstallation is just as easy. Removing the application directory is enough.
Recommended publications
  • Non-Invasive Software Transactional Memory on Top of the Common Language Runtime
    University of Neuchâtel Computer Science Department (IIUN) Master of Science in Computer Science Non-Invasive Software Transactional Memory on top of the Common Language Runtime Florian George Supervised by Prof. Pascal Felber Assisted by Patrick Marlier August 16, 2010 This page is intentionally left blank Table of contents 1 Abstract ................................................................................................................................................. 3 2 Introduction ........................................................................................................................................ 4 3 State of the art .................................................................................................................................... 6 4 The Common Language Infrastructure .................................................................................. 7 4.1 Overview of the Common Language Infrastructure ................................... 8 4.2 Common Language Runtime.................................................................................. 9 4.3 Virtual Execution System ........................................................................................ 9 4.4 Common Type System ........................................................................................... 10 4.5 Common Intermediate Language ..................................................................... 12 4.6 Common Language Specification.....................................................................
    [Show full text]
  • Ironpython in Action
    IronPytho IN ACTION Michael J. Foord Christian Muirhead FOREWORD BY JIM HUGUNIN MANNING IronPython in Action Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> IronPython in Action MICHAEL J. FOORD CHRISTIAN MUIRHEAD MANNING Greenwich (74° w. long.) Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. Sound View Court 3B fax: (609) 877-8256 Greenwich, CT 06830 email: [email protected] ©2009 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15% recycled and processed without the use of elemental chlorine.
    [Show full text]
  • Extending the UHC LLVM Backend: Adding Support for Accurate Garbage Collection
    Extending the UHC LLVM backend: Adding support for accurate garbage collection Paul van der Ende MSc Thesis October 18, 2010 INF/SCR-09-59 Daily Supervisors: Center for Software Technology dr. A. Dijkstra Dept. of Information and Computing Sciences drs. J.D. Fokker Utrecht University Utrecht, the Netherlands Second Supervisor: prof. dr. S.D. Swierstra Abstract The Utrecht Haskell Compiler has an LLVM backend for whole program analyse mode. This backend pre- viously used the Boehm-Weiser library for heap allocation and conservative garbage collection. Recently an accurate garbage collector for the UHC compiler has been developed. We wanted this new garbage collection library to work with the LLVM backend. But since this new collector is accurate, it needs cooperation with the LLVM backend. Functionality needs to be added to find the set of root references and traversing all live references. To find the root set, the bytecode interpreter backend currently uses static stack maps. This is where the problem arises. The LLVM compiler is known to do various aggressive transformations. These optimizations might change the stack layout described by the static stack map. So to avoid this problem we wanted to use the shadow-stack provided by the LLVM framework. This is a dynamic structure maintained on the stack to safely find the garbage collection roots. We expect that the shadow-stack approach comes with a runtime overhead for maintaining this information dynamically on the stack. So we did measure the impact of this method. We also measured the performance improvement of the new garbage collection method used and compare it with the other UHC backends.
    [Show full text]
  • IJIRT | Volume 2 Issue 6 | ISSN: 2349-6002
    © November 2015 | IJIRT | Volume 2 Issue 6 | ISSN: 2349-6002 .Net Surbhi Bhardwaj Dronacharya College of Engineering Khentawas, Haryana INTRODUCTION as smartphones. Additionally, .NET Micro .NET Framework (pronounced dot net) is Framework is targeted at severely resource- a software framework developed by Microsoft that constrained devices. runs primarily on Microsoft Windows. It includes a large class library known as Framework Class Library (FCL) and provides language WHAT IS THE .NET FRAMEWORK? interoperability(each language can use code written The .NET Framework is a new and revolutionary in other languages) across several programming platform created by Microsoft for languages. Programs written for .NET Framework developingapplications. execute in a software environment (as contrasted to hardware environment), known as Common It is a platform for application developers. Language Runtime (CLR), an application virtual It is a Framework that supports Multiple machine that provides services such as Language and Cross language integration. security, memory management, and exception handling. FCL and CLR together constitute .NET IT has IDE (Integrated Development Framework. Environment). FCL provides user interface, data access, database Framework is a set of utilities or can say connectivity, cryptography, web building blocks of your application system. application development, numeric algorithms, .NET Framework provides GUI in a GUI and network communications. Programmers manner. produce software by combining their own source code with .NET Framework and other libraries. .NET is a platform independent but with .NET Framework is intended to be used by most new help of Mono Compilation System (MCS). applications created for the Windows platform. MCS is a middle level interface. Microsoft also produces an integrated development .NET Framework provides interoperability environment largely for .NET software called Visual between languages i.e.
    [Show full text]
  • Improving Memory Management Security for C and C++
    Improving memory management security for C and C++ Yves Younan, Wouter Joosen, Frank Piessens, Hans Van den Eynden DistriNet, Katholieke Universiteit Leuven, Belgium Abstract Memory managers are an important part of any modern language: they are used to dynamically allocate memory for use in the program. Many managers exist and depending on the operating system and language. However, two major types of managers can be identified: manual memory allocators and garbage collectors. In the case of manual memory allocators, the programmer must manually release memory back to the system when it is no longer needed. Problems can occur when a programmer forgets to release it (memory leaks), releases it twice or keeps using freed memory. These problems are solved in garbage collectors. However, both manual memory allocators and garbage collectors store management information for the memory they manage. Often, this management information is stored where a buffer overflow could allow an attacker to overwrite this information, providing a reliable way to achieve code execution when exploiting these vulnerabilities. In this paper we describe several vulnerabilities for C and C++ and how these could be exploited by modifying the management information of a representative manual memory allocator and a garbage collector. Afterwards, we present an approach that, when applied to memory managers, will protect against these attack vectors. We implemented our approach by modifying an existing widely used memory allocator. Benchmarks show that this implementation has a negligible, sometimes even beneficial, impact on performance. 1 Introduction Security has become an important concern for all computer users. Worms and hackers are a part of every day internet life.
    [Show full text]
  • Configure .NET Code-Access Security
    © 2002 Visual Studio Magazine Fawcette Technical Publications Issue VSM November 2002 Section Black Belt column Main file name VS0211BBt2.rtf Listing file name -- Sidebar file name -- Table file name VS0211BBtb1.rtf Screen capture file names VS0211BBfX.bmp Infographic/illustration file names VS0211BBf1,2.bmp Photos or book scans ISBN 0596003471 Special instructions for Art dept. Editor LT Status TE’d3 Spellchecked (set Language to English U.S.) * PM review Character count 15,093 + 1,162 online table Package length 3.5 (I think, due to no inline code/listings) ToC blurb Learn how to safely grant assemblies permissions to perform operations with external entities such as the file system, registry, UIs, and more. ONLINE SLUGS Name of Magazine VSM November 2002 Name of feature/column/department Black Belt column 180-character blurb Learn how to safely grant assemblies permissions to perform operations with external entities such as the file system, registry, UIs, and more. 90-character blurb Learn how to safely grant assemblies permissions to perform operations with external entities. 90-character blurb describing download NA Locator+ code for article VS0211BB_T Photo (for columnists) location On file TITLE TAG & METATAGS <title> Visual Studio Magazine – Black Belt - Secure Access to Your .NET Code Configure .NET Code-Access Security </title> <!-- Start META Tags --> <meta name="Category" content=" .NET "> <meta name="Subcategory" content=" C#, Visual Basic .NET "> <meta name="Keywords" content=" .NET, C#, Visual Basic .NET, security permission, security evidence, security policy, permission sets, evidence, security, security permission stack walk, custom permission set, code group "> [[ Please check these and add/subtract as you see fit .]] <meta name="DESCRIPTION" content=" Learn how to grant assemblies permissions to perform operations with external entities such as the file system, registry, UIs, and more.
    [Show full text]
  • CLS Compliance Rules
    Language Independence and Language-Independent Components https://msdn.microsoft.com/en-us/library/12a7a7h3(d=printer,v=vs.110).aspx Language Independence and Language- Independent Components .NET Framework (current version) The .NET Framework is language independent. This means that, as a developer, you can develop in one of the many languages that target the .NET Framework, such as C#, C++/CLI, Eiffel, F#, IronPython, IronRuby, PowerBuilder, Visual Basic, Visual COBOL, and Windows PowerShell. You can access the types and members of class libraries developed for the .NET Framework without having to know the language in which they were originally written and without having to follow any of the original language's conventions. If you are a component developer, your component can be accessed by any .NET Framework app regardless of its language. Note This first part of this article discusses creating language-independent components—that is, components that can be consumed by apps that are written in any language. You can also create a single component or app from source code written in multiple languages; see Cross-Language Interoperability in the second part of this article. To fully interact with other objects written in any language, objects must expose to callers only those features that are common to all languages. This common set of features is defined by the Common Language Specification (CLS), which is a set of rules that apply to generated assemblies. The Common Language Specification is defined in Partition I, Clauses 7 through 11 of the ECMA-335 Standard: Common Language Infrastructure . If your component conforms to the Common Language Specification, it is guaranteed to be CLS-compliant and can be accessed from code in assemblies written in any programming language that supports the CLS.
    [Show full text]
  • Salesforce CLI Plug-In Developer Guide
    Salesforce CLI Plug-In Developer Guide Salesforce, Winter ’22 @salesforcedocs Last updated: July 21, 2021 © Copyright 2000–2021 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc., as are other names and marks. Other marks appearing herein may be trademarks of their respective owners. CONTENTS Salesforce CLI Plug-In Developer Guide . 1 Salesforce CLI Plug-Ins . 1 Salesforce CLI Architecture . 3 Get Started with Salesforce CLI Plug-In Generation . 5 Naming and Messages for Salesforce CLI Plug-Ins . 7 Customize Your Salesforce CLI Plug-In . 13 Test Your Salesforce CLI Plug-In . 32 Debug Your Salesforce CLI Plug-In . 33 Best Practices for Salesforce CLI Plug-In Development . 33 Resources for Salesforce CLI Plug-In Development . 35 SALESFORCE CLI PLUG-IN DEVELOPER GUIDE Discover how to develop your own plug-ins for Salesforce CLI. Explore the Salesforce CLI architecture. Learn how to generate a plug-in using Salesforce Plug-In Generator, use Salesforce’s libraries to add functionality to your plug-in, and debug issues. Learn about our suggested style guidelines for naming and messages and our recommended best practices for plug-ins. Salesforce CLI Plug-Ins A plug-in adds functionality to Salesforce CLI. Some plug-ins are provided by Salesforce and are installed by default when you install the CLI. Some plug-ins, built by Salesforce and others, you install. When you have a requirement that an existing plug-in doesn’t meet, you can build your own using Node.js. Salesforce CLI Architecture Before you get started with adding functionality to Salesforce CLI, let’s take a high-level look at how the CLI and its dependencies and plug-ins work together.
    [Show full text]
  • NET Framework
    Advanced Windows Programming .NET Framework based on: A. Troelsen, Pro C# 2005 and .NET 2.0 Platform, 3rd Ed., 2005, Apress J. Richter, Applied .NET Frameworks Programming, 2002, MS Press D. Watkins et al., Programming in the .NET Environment, 2002, Addison Wesley T. Thai, H. Lam, .NET Framework Essentials, 2001, O’Reilly D. Beyer, C# COM+ Programming, M&T Books, 2001, chapter 1 Krzysztof Mossakowski Faculty of Mathematics and Information Science http://www.mini.pw.edu.pl/~mossakow Advanced Windows Programming .NET Framework - 2 Contents The most important features of .NET Assemblies Metadata Common Type System Common Intermediate Language Common Language Runtime Deploying .NET Runtime Garbage Collection Serialization Krzysztof Mossakowski Faculty of Mathematics and Information Science http://www.mini.pw.edu.pl/~mossakow Advanced Windows Programming .NET Framework - 3 .NET Benefits In comparison with previous Microsoft’s technologies: Consistent programming model – common OO programming model Simplified programming model – no error codes, GUIDs, IUnknown, etc. Run once, run always – no "DLL hell" Simplified deployment – easy to use installation projects Wide platform reach Programming language integration Simplified code reuse Automatic memory management (garbage collection) Type-safe verification Rich debugging support – CLR debugging, language independent Consistent method failure paradigm – exceptions Security – code access security Interoperability – using existing COM components, calling Win32 functions Krzysztof
    [Show full text]
  • Understanding CIL
    Understanding CIL James Crowley Developer Fusion http://www.developerfusion.co.uk/ Overview Generating and understanding CIL De-compiling CIL Protecting against de-compilation Merging assemblies Common Language Runtime (CLR) Core component of the .NET Framework on which everything else is built. A runtime environment which provides A unified type system Metadata Execution engine, that deals with programs written in a Common Intermediate Language (CIL) Common Intermediate Language All compilers targeting the CLR translate their source code into CIL A kind of assembly language for an abstract stack-based machine, but is not specific to any hardware architecture Includes instructions specifically designed to support object-oriented concepts Platform Independence The intermediate language is not interpreted, but is not platform specific. The CLR uses JIT (Just-in-time) compilation to translate the CIL into native code Applications compiled in .NET can be moved to any machine, providing there is a CLR implementation for it (Mono, SSCLI etc) Demo Generating IL using the C# compiler .method private hidebysig static void Main(string[] args) cil managed { .entrypoint // Code size 31 (0x1f) Some familiar keywords with some additions: .maxstack 2 .locals init (int32 V_0, .method – this is a method int32 V_1, hidebysig – the method hides other methods with int32 V_2) the same name and signature. IL_0000: ldc.i4.s 50 cil managed – written in CIL and should be IL_0002: stloc.0 executed by the execution engine (C++ allows IL_0003: ldc.i4.s
    [Show full text]
  • Comparative Studies of Programming Languages; Course Lecture Notes
    Comparative Studies of Programming Languages, COMP6411 Lecture Notes, Revision 1.9 Joey Paquet Serguei A. Mokhov (Eds.) August 5, 2010 arXiv:1007.2123v6 [cs.PL] 4 Aug 2010 2 Preface Lecture notes for the Comparative Studies of Programming Languages course, COMP6411, taught at the Department of Computer Science and Software Engineering, Faculty of Engineering and Computer Science, Concordia University, Montreal, QC, Canada. These notes include a compiled book of primarily related articles from the Wikipedia, the Free Encyclopedia [24], as well as Comparative Programming Languages book [7] and other resources, including our own. The original notes were compiled by Dr. Paquet [14] 3 4 Contents 1 Brief History and Genealogy of Programming Languages 7 1.1 Introduction . 7 1.1.1 Subreferences . 7 1.2 History . 7 1.2.1 Pre-computer era . 7 1.2.2 Subreferences . 8 1.2.3 Early computer era . 8 1.2.4 Subreferences . 8 1.2.5 Modern/Structured programming languages . 9 1.3 References . 19 2 Programming Paradigms 21 2.1 Introduction . 21 2.2 History . 21 2.2.1 Low-level: binary, assembly . 21 2.2.2 Procedural programming . 22 2.2.3 Object-oriented programming . 23 2.2.4 Declarative programming . 27 3 Program Evaluation 33 3.1 Program analysis and translation phases . 33 3.1.1 Front end . 33 3.1.2 Back end . 34 3.2 Compilation vs. interpretation . 34 3.2.1 Compilation . 34 3.2.2 Interpretation . 36 3.2.3 Subreferences . 37 3.3 Type System . 38 3.3.1 Type checking . 38 3.4 Memory management .
    [Show full text]
  • Working with Ironpython and WPF
    Working with IronPython and WPF Douglas Blank Bryn Mawr College Programming Paradigms Spring 2010 With thanks to: http://www.ironpython.info/ http://devhawk.net/ IronPython Demo with WPF >>> import clr >>> clr.AddReference("PresentationFramework") >>> from System.Windows import * >>> window = Window() >>> window.Title = "Hello" >>> window.Show() >>> button = Controls.Button() >>> button.Content = "Push Me" >>> panel = Controls.StackPanel() >>> window.Content = panel >>> panel.Children.Add(button) 0 >>> app = System.Windows.Application() >>> app.Run(window) XAML Example: Main.xaml <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x="http://schemas.microsoft.com/winfx/2006/xaml" Title="TestApp" Width="640" Height="480"> <StackPanel> <Label>Iron Python and WPF</Label> <ListBox Grid.Column="0" x:Name="listbox1" > <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=title}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </StackPanel> </Window> IronPython + XAML import sys if 'win' in sys.platform: import pythoncom pythoncom.CoInitialize() import clr clr.AddReference("System.Xml") clr.AddReference("PresentationFramework") clr.AddReference("PresentationCore") from System.IO import StringReader from System.Xml import XmlReader from System.Windows.Markup import XamlReader, XamlWriter from System.Windows import Window, Application xaml = """<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Title="XamlReader Example" Width="300" Height="200"> <StackPanel Margin="5"> <Button
    [Show full text]