GNU Coding Guidelines Shakthi Kannan GNU Free Documentation License

Slides:



Advertisements
Similar presentations
DEVICE DRIVER VINOD KAMATH CS691X PROJECT WORK. Introduction How to write/install device drivers Systems, Kernel Programming Character, Block and Network.
Advertisements

Linux device-driver issues
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Computer System Laboratory
Compilation and Debugging 101. Compilation in C/C++ hello.c Preprocessor Compiler stdio.h tmpXQ.i (C code) hello.o (object file)
What is GNU/Linux (Not Linux!)? David Sudjiman davidsudjiman (at) yahoo (dot) com The latest version of this document can.
Dynamic Memory Allocation in C.  What is Memory What is Memory  Memory Allocation in C Memory Allocation in C  Difference b\w static memory allocation.
USERSPACE I/O Reporter: R 張凱富.
CS 450 Module R1. R1 Introduction In Module R1, you will implement a user interface (command handler). There are a couple of options: ▫Command Line: interface.
Programming Languages and Paradigms The C Programming Language.
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
SPLINT STATIC CHECKING TOOL Sripriya Subramanian 10/29/2002.
C Intro.
Programming in C Pointers and Arrays. 1/14/102 Pointers and Arrays In C, there is a strong relationship between pointers and arrays.In C, there is a strong.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
C For Java Programmers Tom Roeder CS sp. Why C? The language of low-level systems programming  Commonly used (legacy code)  Trades off safety.
Open Source Basics: Definitions, Models, and Questions Johndan Johnson-Eilola Clarkson University.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction.
Programming in C Pointers and Arrays. 1/14/102 Pointers and Arrays In C, there is a strong relationship between pointers and arrays.In C, there is a strong.
Carnegie Mellon 1 Debugging and Version control / : Introduction to Computer Systems 12 th Recitation, Nov. 14, 2011 Slides by: Lin Xiao(lxiao)
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
Debugging, Build and Version Control Rudra Dutta CSC Spring 2007, Section 001.
Operating System Program 5 I/O System DMA Device Driver.
Copyright and Software and You. What is copyright? The Copyright Act of 1976 prevents the unauthorized copying of a work of authorship. – However, only.
Writing your own Madagascar applications Sergey Fomel University of Texas at Austin August 30, 2006 Vancouver, BC.
chap13 Chapter 13 Programming in the Large.
NRCCL (University of Oslo, Faculty of Law) Copyleft and Open Source Jon Bing Notrwegian Research Center for Computers and Law Master Lecture 13 October.
Development of Multiplatform, VR Applications Pablo Figueroa 1, Pierre Boulanger 1, H. J. Hoover 1, Mark Green 2, Robyn Taylor 1 1.University of Alberta.
1 1 © AdaCore under the GNU Free Documentation License Franco Gasperoni
1 Homework HW5 due today Review a lot of things about allocation of storage that may not have been clear when we covered them in our initial pass Introduction.
Debugging 1/6/2016. Debugging 1/6/2016 Debugging  Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a program.
Lab 12 Department of Computer Science and Information Engineering National Taiwan University Lab12 – Driver 2014/12/16 1 /21.
COMP 3438 – Part I - Lecture 5 Character Device Drivers
INTRODUCTION TO AUTOCONF AND AUTOMAKE. GNU BUILD SYSTEM 1)GNU AUTOCONF 2)GNU AUTOMAKE 3)GNU LIBTOOL 4)GNU GETTEXT.
CMSC 104, Version 8/061L14AssignmentOps.ppt Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips Reading Section.
Revisiting building. Preprocessing + Compiling 2 Creates an object file for each code file (.c ->.o) Each.o file contains code of the functions and structs.
Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 4, 2010 CSCE 212Honors Computer Organization.
PowerTalk automatically speaks the text in presentations while you operate PowerPoint as usual. It uses computer speech that comes with Windows XP and.
Geospatial Information: Copyright Issues Professor George Cho Professor of Geoinformatics and the Law University of Canberra
The Essentials of a Java Program JavaMethods An Introduction to Object-Oriented Programming Maria Litvin Gary Litvin Copyright © 2003 by Maria Litvin,
C# Part 1 Intro to C#. Background Designed to be simple, modern, general- purpose, OO, programming language Strong type checking, array bounds checking,
LINUX History In 1984 a project was launched by Richard Stallman to develop a complete Unix-like operating system that would be considered free software.
Developing WordPress Plugins
More Sophisticated Behavior
What is Copyright?.
Programming Languages and Paradigms
Command Line Arguments
CSCE 212Honors Computer Organization
CSE 303 Concepts and Tools for Software Development
Software Development with uMPS
Programming Paradigms
Introduction to C Programming Language
CSS 161: Fundamentals of Computing
Instructor: Ioannis A. Vetsikas
Introduction to GSL CS 3414 From GNU Scientific Library Reference Manual at
Automation in an XML Authoring Environment
Ruby Testing 2, 11/9/2004.
Govt. Polytechnic,Dhangar
Programming in C Miscellaneous Topics.
Programming in C Miscellaneous Topics.
GNU General Public License (GPL)
Computer System Laboratory
APACHE LICENSE HISTORICAL EVOLUTION
Programming in C Pointers and Arrays.
Programming Languages and Paradigms
CSCE 212Honors Computer Organization
Standard Version of Starting Out with C++, 4th Edition
SAS v17 Contents and schedule.
Presentation transcript:

GNU Coding Guidelines Shakthi Kannan GNU Free Documentation License October 2007 Version 1.0

How to use the GPL /* * main.c * * The main file of the program * Copyright (C) 2007 Shakthi Kannan <shakthi.kannan@qvantel.com> * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */

Clean-up temporary files. Check $TMPDIR. Else use /tmp. Clean-up temporary files.

Error messages Interactive programs Non-interactive programs program : message program : source-file-name : lineno : message program : source-file-name : lineno : column : message Interactive programs source-file-name: lineno-1-lineno-2: message source-file-name: lineno-1.column-1-column-2: message source-file-name: lineno-1.column-1-lineno-2.column-2: message

Comments /* So, you can comment? */ /* * You can pass more comments?

Naming Use lowercase only for variables. int pencil; Separate names with underscore: int return_my_pencil; Use all CAPS for constants. #define JAMES_BOND 007

Functions Check return values. Example: malloc () system calls

Function declaration void add_to_list (char *buf, char *rbuf); char *gamma (char *buf); int run_test (struct gnc *x);

C function parentheses /* the main function */ int main (int argc, char *argv[]) { }

Long function arguments void select_team (char *players, int advertising, int eleven) { /* do nothing */ }

if-else constructs if (you_sleep) { printf (“Good”); } else printf (“You're awake!”);

do-while constructs do { /* speak the truth */ } while (true);

Splitting long expressions split before operator if (bored_life && dull_friends && remaining_conditions) { /* cheer up! */ }

Internationalization Use GNU gettext file.c printf (_(“%s, never take life seriously. Nobody gets out alive, anyway\n” your_name); file.pot msgid “%s, never take life seriously. Nobody gets out alive, anyway\n” msgstr “”

ChangeLog 2006-02-07 Matthew Allum <mallum@openedhand.com> * applets/mb-applet-system-monitor.c: (system_memory), (main): * configure.ac: Detect kernel version at run rather than build time. 2006-01-27 Matthew Allum <mallum@openedhand.com> * src/msg.c: (_get_server_time), (msg_win_create), (msg_handle_events), (msg_calc_win_size): * src/panel.c: (panel_main): * src/session.c: (session_preexisting_clear_current): * src/session.h: Apply patch from Phil Blundell remove uneeded polling. ( See bug #68 )

README README ===== Greetings! The directory contains simple Linux device driver code examples, for character device operations. The device drivers are for 2.6 kernels. The code examples include: ex1-hello-world/ ex2-init-exit/ ex3-doc-license/ ex4-param/ ex5-multi-file/ ex6-char-register/ ex7-char-dev-register/ ex8-char-dev-register-dynamic/ ex9-write/ ex10-read/ ex11-debug/ ex12-proc/ ex13-ioctl

References Richard Stallman. September 23, 2007. GNU Coding Standards. http://www.gnu.org/prep/standards/ Gary V. Vaughan, Ben Elliston, Tom Tromey, and Ian Lance Taylor. February 8, 2006. GNU Autoconf, Automake, and Libtool. http://sources.redhat.com/autobook/