static void printGeom (PrintingContext &c, dxGeom *g)
{
    unsigned long category = dGeomGetCategoryBits (g);
    if (category != (unsigned long)(~0)) {
        c.printIndent();
        fprintf (c.file,"category_bits = %lu\n",category);
    }
    unsigned long collide = dGeomGetCollideBits (g);
    if (collide != (unsigned long)(~0)) {
        c.printIndent();
        fprintf (c.file,"collide_bits = %lu\n",collide);
    }
    if (!dGeomIsEnabled (g)) {
        c.print ("disabled",1);
    }
    switch (g->type) {
        case dSphereClass: printSphere (c,g); break;
        case dBoxClass: printBox (c,g); break;
        case dCapsuleClass: printCapsule (c,g); break;
        case dCylinderClass: printCylinder (c,g); break;
        case dPlaneClass: printPlane (c,g); break;
        case dRayClass: printRay (c,g); break;
        case dConvexClass: printConvex (c,g); break;
        case dTriMeshClass: printTriMesh (c,g); break;
        case dHeightfieldClass: printHeightfieldClass (c,g); break;
    }
}
static void printLMotor (PrintingContext &c, dxJoint *j)
{
    dxJointLMotor *a = (dxJointLMotor*) j;
    c.print("num", a->num);
    c.printIndent();
    fprintf (c.file,"rel = {%d,%d,%d},\n",a->rel[0],a->rel[1],a->rel[2]);
    c.print ("axis1",a->axis[0]);
    c.print ("axis2",a->axis[1]);
    c.print ("axis3",a->axis[2]);
    for (int i=0; i<3; i++) printLimot (c,a->limot[i],i+1);
}
static void printLimot (PrintingContext &c, dxJointLimitMotor &limot, int num)
{
    if (num >= 0) {
        c.printIndent();
        fprintf (c.file,"limit%d = {\n",num);
    }
    else {
        c.print ("limit = {");
    }
    c.indent++;
    c.print ("low_stop",limot.lostop);
    c.print ("high_stop",limot.histop);
    c.printNonzero ("bounce",limot.bounce);
    c.print ("ODE = {");
    c.indent++;
    c.printNonzero ("stop_erp",limot.stop_erp);
    c.printNonzero ("stop_cfm",limot.stop_cfm);
    c.indent--;
    c.print ("},");
    c.indent--;
    c.print ("},");

    if (num >= 0) {
        c.printIndent();
        fprintf (c.file,"motor%d = {\n",num);
    }
    else {
        c.print ("motor = {");
    }
    c.indent++;
    c.printNonzero ("vel",limot.vel);
    c.printNonzero ("fmax",limot.fmax);
    c.print ("ODE = {");
    c.indent++;
    c.printNonzero ("fudge_factor",limot.fudge_factor);
    c.printNonzero ("normal_cfm",limot.normal_cfm);
    c.indent--;
    c.print ("},");
    c.indent--;
    c.print ("},");
}