qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] ?off? ide/code editor under linux


From: NyOS
Subject: Re: [Qemu-devel] ?off? ide/code editor under linux
Date: Sun, 06 Aug 2006 07:55:59 +0200
User-agent: Opera Mail/9.00 (Linux)

On Sun, 06 Aug 2006 05:52:46 +0200, M. Warner Losh <address@hidden> wrote:

In message: <address@hidden>
            NyOS <address@hidden> writes:
: #ifndef _FOO_H //capitals!
: #define _FOO_H //capitals!

You sould avoid using _FOO_H for the define here.  That's in the
implementation space and strictly speaking off limits to programmers
that merely use the system.  FOO_H is better, and likely sufficiently
unambiguous.

Warner

Ok, that's true.. corrected..
But defines have full capital names traditionally (as you wrote FOO_H and not foo_h).. Files/modules are lowercase..

AFAIK, even the most complex (I think) IDE I tried, kdevelop supports only a simple substitution, it cannot capitalize module name, neither allows to concatenate with "_H". (Or does it an undocumented way)



address@hidden:~$ cat bin/newmodule
#!/bin/bash

#newmodule foo
#creates foo.cpp and foo.h

if [ "$1" == "--help" ];then
  echo "usage: newmodule <modulename>"
  exit 0
fi

MODULENAME=$1
DEFINENAME=`toupper $1`
HFILE=${MODULENAME}.h
CPPFILE=${MODULENAME}.cpp
DIR=~/src/nyfiletemplates/
NEWCPP=${DIR}/cpp
NEWH=${DIR}/h

if [ -f ${CPPFILE} ]; then
  mv -f ${CPPFILE} /tmp/${CPPFILE}.old
fi

if [ -f ${HFILE} ]; then
  mv -f ${HFILE} /tmp/${HFILE}.old
fi

sed -e "s/newfile/${MODULENAME}/g" -e "s/NEWFILE/${DEFINENAME}/g" <${NEWCPP} >${CPPFILE} sed -e "s/newfile/${MODULENAME}/g" -e "s/NEWFILE/${DEFINENAME}/g" <${NEWH}
${HFILE}



address@hidden:~/src/nyfiletemplates$ cat h
/*
  description of newfile
*/

#ifndef NEWFILE_H
#define NEWFILE_H

//newfile class
class newfile
{
  protected:
    //attributes

  public:
    //default constructor of newfile
    newfile();

    //destructor of newfile
    ~newfile();

    //methods

};

#endif


address@hidden:~/src/nyfiletemplates$ cat cpp
#include "headers.h"
#include "newfile.h"

newfile::newfile()
{

}

newfile::~newfile()
{

}

//methods



Sorry for typos.. I've translated variable names and comments in this letter to English (and removed unnecessary parts)..
I think You can understand its point..
toupper makes uppercase letters (ok, it could be done with tr), sed substitutes.. ugly, but works.. I've got similar scripts for creating methods and putting in the code, adding attributes (and inserting default getter/setter methods).. But I'd like to get rid of them.. (Or at least call them a bit cultivated way, use a hotkey and give parameters on an X/curses form)

So? What is Your advise? I'm open for new programs.

Nyos




reply via email to

[Prev in Thread] Current Thread [Next in Thread]