qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: NyOS <lista@nyos.homelinux.net>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] ?off? ide/code editor under linux
Date: Sun, 06 Aug 2006 07:55:59 +0200	[thread overview]
Message-ID: <op.tdulflont9pcbo@mail.chello.hu> (raw)
In-Reply-To: <20060805.215246.-399283022.imp@bsdimp.com>

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

> In message: <op.tdt9smcut9pcbo@mail.chello.hu>
>             NyOS <lista@nyos.homelinux.net> 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)



nyos@nyos:~$ 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}



nyos@nyos:~/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


nyos@nyos:~/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	other threads:[~2006-08-06  5:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-06  1:44 [Qemu-devel] ?off? ide/code editor under linux NyOS
2006-08-06  3:52 ` M. Warner Losh
2006-08-06  5:55   ` NyOS [this message]
2006-08-06 11:13 ` Thomas Steffen
2006-08-06 16:21 ` Oliver Gerlich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.tdulflont9pcbo@mail.chello.hu \
    --to=lista@nyos.homelinux.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).