Monday, October 31, 2011

D programming under MacOS X 10.6, LDC

See http://dsource.org/projects/ldc/wiki/OSXBuildInstructions

Macports to install llvm package (2.9). Then get the latest LDC (tip) from bitbucket mercurial repo, ccmake, adjust paths to match those of MacPorts (/opt/local).

Then build and install tango, as described in the link above.

Edit ldc.conf


switches = [
"-I/opt/local/include/d",
"-I/opt/local/include/d/tango/core/vendor",
"-L-L%%ldcbinarypath%%/../lib",
"-L-ltango",
"-d-version=Tango",
"-defaultlib=tango-ldc",
"-debuglib=tango-ldc"
];

Thursday, January 27, 2011

LDC under MacOSX

Can't build it yet but the information I gathered is as follows:

Setup

sudo port install llvm
sudo port install llvm-devel
sudo port install mercurial
sudo port install ruby
sudo port install cmake

hg clone -r 0.9.2 https://bitbucket.org/lindquist/ldc
svn co http://svn.dsource.org/projects/tango/tags/releases/0.99.9 tango




Building LDC


cmake -DCMAKE_BUILD_TYPE=Release -DDEFAULT_TARGET="x86_64-apple-darwin10" ../ldc
make -j2




Building Tango





Links


https://bitbucket.org/lindquist/ldc
http://www.dsource.org/projects/tango
http://dsource.org/projects/ldc/wiki/BuildInstructionsTangoTrunk

Wednesday, January 26, 2011

ext2/3 from macosx

http://code.google.com/p/macfuse/

http://sourceforge.net/projects/fuse-ext2/

Sunday, October 3, 2010

Genius G-Pen 560 under Ubuntu 10.04

1) add ppa and install wizardpen driver (xorg) from it
2) edit /usr/lib/X11/xorg.conf.d/70-wizardpen.conf to the following:

Section "InputClass"
Identifier "wizardpen"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
# MatchVendor "UC-LOGIC|KYE Systems|Ace Cad"
Driver "wizardpen"
Option "TopZ" "32"
Option "BottomZ" "1023"
Option "TopX" "185"
Option "TopY" "372"
Option "BottomX" "11811"
Option "BottomY" "8793"

EndSection
Section "InputClass"
Identifier "wizardpen ignore mouse dev"
MatchIsTablet "on"
MatchDevicePath "/dev/input/mouse*"
# MatchVendor "UC-LOGIC|KYE Systems|Ace Cad"
Driver ""
EndSection

3) reboot

Sunday, December 27, 2009

link once (simulating c++ template code in pure c with GCC extensions)

The following definition will be merged in all compiled object files, i.e. the first function implementation will be linked into the produced binary and the following copies rejected.


__attribute__((section(".gnu.linkonce.c"))) int commonFunc(int a, int b) {
return a-b;
}

Simmulating "exceptions" in pure C

 #include <stdio.h>  
#include <setjmp.h>
typedef struct ExcHandlerDesc_ {
struct ExcHandlerDesc_ * prev;
jmp_buf jmpBuf;
int handled; // 0 = did not handle the exception
int excId; // the id of unhandled exception for rethrow
} ExcHandlerDesc;
static ExcHandlerDesc * xroot;
#define XR_CODE_BLOCK 0
#define XR_FINALLY_BLOCK -1
// starting exception id
#define XR_EXC_ID 2
//#define X_TRY(exchd_) addXHandler(exchd_); switch (setjmp(exchd_.jmpBuf)) {
//#define X_END(exchd_) }; removeXHandler(exchd_);
////////
void throwIt(int v) {
if (xroot == 0) {
printf("Unhandled exception %i !!!\n", v);
exit(1);
}
xroot->excId = v;
//xroot->handled = 1;
longjmp(xroot->jmpBuf, v);
}
void addXHandler(ExcHandlerDesc*d) {
d->handled = 1;
d->prev = xroot;
xroot = d;
}
void removeXHandler() {
if (xroot) {
xroot = xroot->prev;
}
}
////////
void funcWithExc() {
// throw
throwIt(2);
}
void func1() {
funcWithExc();
}
void func0()
{
int a;
// try
ExcHandlerDesc xhd;
addXHandler(&xhd);
a = setjmp(xhd.jmpBuf);
if ((a != XR_CODE_BLOCK) && (xroot == &xhd)) {
removeXHandler();
}
switch(a) {
case XR_CODE_BLOCK:
func1();
break;
case XR_FINALLY_BLOCK:
// do cleanup
if (!xhd.handled)
throwIt(xhd.excId);
break;
case XR_EXC_ID:
// handle it
printf("Caught %i !\n", xhd.excId);
// handler is removed and rethrow here is allowed
throwIt(2);
break;
default:
// unhandled!
xhd.handled = 0;
break;
}
// cleanup
if (a != XR_FINALLY_BLOCK)
longjmp(xhd.jmpBuf, XR_FINALLY_BLOCK);
/// end exception handling
}
int main() {
func0();
return 0;
}

Sunday, May 17, 2009

Ubuntu 9.04 on HP Compaq 6510b

Core2Duo T7250, 2GB, intel 965

LiveCD runs fine, all hardware works.
After installation everything works just fine except compiz -- it doesn't run, although 3D games like TuxRacer, Chromium etc. run smooth.