Tuesday, February 26, 2008

GNU Source-highlight 2.9

I've just released GNU Source-Highlight 2.9.

Apart the usual bug fixes, the major functional addition is the use of a file (called style.defaults) where you can specify that if a style is not defined for a specific element, then it defaults to another element. For instance, the element "preproc" if not specified will be highlighted as "keyword".

Furthermore, references for XHTML output files are not generated.

Then there were some additions concerning language definition files.

First of all, I've added c.lang for highlighting C programs (i.e., not C++). This was required in cases where in C you use names for variables that are keywords in C++ (e.g., "class").

As for programming languages, the new addition is the language definition for Haxe (provided by Jos Hirth); I actually didn't know this language, which is similar to Java.

/*
* test for haxe
*/
import Math;
class ShuffleBag{

var data:Array<Int>;
var cursor:Int;

//c'tor
public function new(){
data=[];
cursor=-1;

//pointless preprocessor tests :)
#if neko //nya :3
trace("neko");
#else flash9//no space

trace("flash9");
#end //foo

#if flash8
trace("flash8");

#end//no space
}
//add one or several item(s)
public function add(item:Int,?quantity:Int){

if(quantity==null){
data.push(item);

}else{
for(i in 0...quantity)
data.push(item);

}
cursor=data.length-1;
}
//returns the next item in the bag

public function next(){
if(cursor<1){

cursor=data.length-1;
return data[0];

}
var grab:Int=Math.floor(Math.random()*(cursor+1));

var temp:Int=data[grab];
data[grab]=data[cursor];

data[cursor]=temp;
cursor--;
return temp;

}
}

Then, I've added highlighting for some property/configuration files:
Property files:

# a comment
! a comment

source.favorites.jar = src/
output.favorites.jar = bin/
bin.includes = plugin.xml,\
META-INF/,\
favorites.jar,\
icons/
foo


a = "foo"
b = a string with escape sequences \t \n \r \\ \" \' \ (space) \u0123
c = a string with a continuation line \
continuation line
d.e.f = another string

.ini files:

[BrowserBar]
Width=295

# a comment

[Filebrowser]
Dir History=
Location=file://$HOME/

Separate Directories=false
Show Preview=false
Show hidden files=false
Sort by=Name
Sort case insensitively=true
Sort directories first=true

Sort reversed=false
View Style=Simple

[General]
HiddenOnExit=false
Timeout=20

[PlaylistColumnsLayout]
ColumnNames=Filename,Title,Artist,AlbumArtist,Composer,Year,Album,DiscNumber,Track,BPM,Genre,Comment,Directory,Type,Length,Bitrate,SampleRate,Score,Rating,PlayCount,LastPlayed,Mood,Filesize

ColumnOrder=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
ColumnWidths=0,184,92,0,0,100,92,0,0,0,0,0,73,0,80,0,0,0,0,0,0,0,0
ColumnsVersion=1
SortAscending=true
SortColumn=200

[Desktop Entry]

Encoding=UTF-8
Name=prova
Exec=prova %i %m -caption "%c"
Icon=prova
Type=Application
DocPath=prova/prova.html

Comment=A KDE KPart Application
Comment[fr]=Une application KPart pour KDE.
Comment[pt_BR]=Um Aplicativo KPart do KDE
Comment[it]=Applicazione KPart di KDE

.lsm files:

Begin3
Title: sourcehighlightide -- Some description
Version: 0.1
Entered-date:
Description:
Keywords: KDE Qt
Author: Lorenzo Bettini <http://www.lorenzobettini.it>

Maintained-by: Lorenzo Bettini <http://www.lorenzobettini.it>
Home-page:
Alternate-site:
Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
xxxxxx sourcehighlightide-0.1.tar.gz
xxx sourcehighlightide-0.1.lsm
Platform: Linux. Needs KDE

Copying-policy: GPL
End

.rpm spec files:

#
# spec file for package GNU Source Highlight (Version 1.x)
#
# Author: Christian W. Zuckschwerdt, Jan 2003
#

Summary: syntax highlighting for source documents

Name: source-highlight
Version: 2.9
Release: 2.9
License: GPL
Group: Utilities/Console

Source: ftp://ftp.gnu.org/gnu/source-highlight/%{name}-%{version}.tar.gz
URL: http://www.gnu.org/software/src-highlite/
BuildRoot: %{_tmppath}/%{name}-%{version}-root


%description
This program, given a source file, produces a document
with syntax highlighting. Both source languages and output formats
can be specified with a simple syntax and added dynamically. At the
moment this package can handle many programming languages, such as,
e.g., Java, C/C++, Prolog, Perl, Php3, Python, Flex, ChangeLog, etc.
as source languages, and some output formats such, as, e.g., HTML,
XHTML, LaTeX, etc.

%prep
%setup -q

%build
./configure $MYARCH_FLAGS \
--prefix=%{_prefix} \
--mandir=%{_mandir} \
--datadir=%{_datadir}

make

%install
rm -rf $RPM_BUILD_ROOT

make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(644, root, root, 755)
%doc README COPYING ChangeLog TODO.txt AUTHORS THANKS
%doc doc/*.html doc/*.css
%attr(755,root,root) %{_prefix}/bin/*

%{_datadir}/%{name}/*
%{_mandir}/man?/*

Saturday, February 23, 2008

The good ol' serial modems

I recently bought a new laptop, a Dell Latitude D630, which is equipped with an internal modem, with a Conexant chipset. You can find the Linux drivers for this modem at linuxant.com, but you need to pay a registration fee for getting the full speed for these drivers (I did this in the past for my previous laptops). However, Dell provides its users with free Conexant drivers for its laptops! Unfortunately, for the moment, these drivers do not seem to be updated for the Kubuntu 7.10 I installed on my laptop.

Well, I have ADSL at my place, but sometimes, I work in places where ADSL is not available, and I can rely only on the old telephone line, that's why I'd need to use the modem.

This time, I decided not to pay for the drivers, and wait for Dell to update its drivers... but I still needed to access the Internet through the telephone. I then remembered I still had an old external serial 56k modem... well... I connected, and configured it with kppp and in a moment I was surfing the Internet under Linux :-)


Ah! the good ol' serial modems! Ready to be used! Not like those fake soft(win)modems... and all those flashing lights :-)

Farewell, Espon Stylus Color II

It's time to say goodbye to my good ol' Epson Stylus Color II, after 10 years!

This was my first ink jet color printer; I bought it for the exam of "Calcolo Numerico", and it wasn't quite cheap at that time.

The color printing is quite ugly, especially when comparing it to the quality of today color printers, but at that time, that was the only thing I could afford.

The printer was quite slow, and the paper was continuously jamming.

I had kept this printer in my office for "quick" prints, instead of using the network printer that was not very near.

However, now the sheets are not loaded very well any more, the ink cartridges are harder to find (and very expensive), so I can't see any more reason to keep it.

But it's kind of sad getting rid of my first ink jet printer... ;-)