diff --git a/doc/includes/references.h b/doc/includes/references.h index faabc619..66e4139a 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -509,12 +509,12 @@ typedef enum mjtConstraint_ { // type of constraint mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone } mjtConstraint; -typedef enum mjtConstraintState_ { // constraint state - mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) - mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) - mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) - mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) - mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) +typedef enum mjtConstraintState_ { // constraint state + mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) + mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) + mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) + mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) + mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) } mjtConstraintState; typedef enum mjtSensor_ { // type of sensor // common robotic sensors, attached to a site @@ -1234,11 +1234,11 @@ typedef enum mjtGridPos_ { // grid position for overlay mjGRID_BOTTOMLEFT, // bottom left mjGRID_BOTTOMRIGHT // bottom right } mjtGridPos; -typedef enum mjtFramebuffer_ { // OpenGL framebuffer option +typedef enum mjtFramebuffer_ { // OpenGL framebuffer option mjFB_WINDOW = 0, // default/window buffer mjFB_OFFSCREEN // offscreen buffer } mjtFramebuffer; -typedef enum mjtFontScale_ { // font scale, used at context creation +typedef enum mjtFontScale_ { // font scale, used at context creation mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling mjFONTSCALE_150 = 150, // 150% scale @@ -1467,9 +1467,9 @@ struct mjuiItemSingle_ { // check and button-related }; -struct mjuiItemMulti_ { // static, radio and select-related - int nelem; // number of elements in group - char name[mjMAXUIMULTI][mjMAXUINAME]; // element names +struct mjuiItemMulti_ { // static, radio and select-related + int nelem; // number of elements in group + char name[mjMAXUIMULTI][mjMAXUINAME]; // element names }; @@ -1496,10 +1496,10 @@ struct mjuiItem_ { // UI item // type-specific properties union { - struct mjuiItemSingle_ single; // check and button - struct mjuiItemMulti_ multi; // static, radio and select - struct mjuiItemSlider_ slider; // slider - struct mjuiItemEdit_ edit; // edit + struct mjuiItemSingle_ single; // check and button + struct mjuiItemMulti_ multi; // static, radio and select + struct mjuiItemSlider_ slider; // slider + struct mjuiItemEdit_ edit; // edit }; // internal @@ -1825,7 +1825,7 @@ struct mjvFigure_ { // abstract 2D figure passed to OpenGL rendere // text labels char title[1000]; // figure title; subplots separated with 2+ spaces char xlabel[100]; // x-axis label - char linename[mjMAXLINE][100]; // line names for legend + char linename[mjMAXLINE][100]; // line names for legend // dynamic settings int legendoffset; // number of lines to offset legend @@ -1853,10 +1853,8 @@ int mj_makeEmptyFileVFS(mjVFS* vfs, const char* filename, int filesize); int mj_findFileVFS(const mjVFS* vfs, const char* filename); int mj_deleteFileVFS(mjVFS* vfs, const char* filename); void mj_deleteVFS(mjVFS* vfs); -mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, - char* error, int error_sz); -int mj_saveLastXML(const char* filename, const mjModel* m, - char* error, int error_sz); +mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, char* error, int error_sz); +int mj_saveLastXML(const char* filename, const mjModel* m, char* error, int error_sz); void mj_freeLastXML(void); int mj_printSchema(const char* filename, char* buffer, int buffer_sz, int flg_html, int flg_pad); diff --git a/include/mujoco/mjmodel.h b/include/mujoco/mjmodel.h index fbe18093..6350d953 100644 --- a/include/mujoco/mjmodel.h +++ b/include/mujoco/mjmodel.h @@ -255,12 +255,12 @@ typedef enum mjtConstraint_ { // type of constraint } mjtConstraint; -typedef enum mjtConstraintState_ { // constraint state - mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) - mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) - mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) - mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) - mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) +typedef enum mjtConstraintState_ { // constraint state + mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) + mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) + mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) + mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) + mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) } mjtConstraintState; diff --git a/include/mujoco/mjplugin.h b/include/mujoco/mjplugin.h index 315438ed..127da354 100644 --- a/include/mujoco/mjplugin.h +++ b/include/mujoco/mjplugin.h @@ -66,36 +66,36 @@ typedef struct mjpPlugin_ mjpPlugin; #if defined(__has_attribute) -#if __has_attribute(constructor) -#define mjPLUGIN_DYNAMIC_LIBRARY_INIT \ - __attribute__((constructor)) static void _mjplugin_init(void) -#endif + #if __has_attribute(constructor) + #define mjPLUGIN_DYNAMIC_LIBRARY_INIT \ + __attribute__((constructor)) static void _mjplugin_init(void) + #endif // __has_attribute(constructor) #elif defined(_MSC_VER) -#ifndef mjDLLMAIN -#define mjDLLMAIN DllMain -#endif + #ifndef mjDLLMAIN + #define mjDLLMAIN DllMain + #endif -#if !defined(mjEXTERNC) -#if defined(__cplusplus) -#define mjEXTERNC extern "C" -#else -#define mjEXTERNC -#endif // defined(__cplusplus) -#endif // !defined(mjEXTERNC) + #if !defined(mjEXTERNC) + #if defined(__cplusplus) + #define mjEXTERNC extern "C" + #else + #define mjEXTERNC + #endif // defined(__cplusplus) + #endif // !defined(mjEXTERNC) -// NOLINTBEGIN(runtime/int) -#define mjPLUGIN_DYNAMIC_LIBRARY_INIT \ - static void _mjplugin_dllmain(void); \ - mjEXTERNC int __stdcall mjDLLMAIN(void* hinst, unsigned long reason, void* reserved) { \ - if (reason == 1) { \ - _mjplugin_dllmain(); \ - } \ - return 1; \ - } \ - static void _mjplugin_dllmain(void) -// NOLINTEND(runtime/int) + // NOLINTBEGIN(runtime/int) + #define mjPLUGIN_DYNAMIC_LIBRARY_INIT \ + static void _mjplugin_dllmain(void); \ + mjEXTERNC int __stdcall mjDLLMAIN(void* hinst, unsigned long reason, void* reserved) { \ + if (reason == 1) { \ + _mjplugin_dllmain(); \ + } \ + return 1; \ + } \ + static void _mjplugin_dllmain(void) + // NOLINTEND(runtime/int) #endif // defined(_MSC_VER) diff --git a/include/mujoco/mjrender.h b/include/mujoco/mjrender.h index 2e095d40..fb37d926 100644 --- a/include/mujoco/mjrender.h +++ b/include/mujoco/mjrender.h @@ -15,7 +15,6 @@ #ifndef MUJOCO_MJRENDER_H_ #define MUJOCO_MJRENDER_H_ -#include #if defined(__cplusplus) extern "C" { @@ -35,13 +34,13 @@ typedef enum mjtGridPos_ { // grid position for overlay } mjtGridPos; -typedef enum mjtFramebuffer_ { // OpenGL framebuffer option +typedef enum mjtFramebuffer_ { // OpenGL framebuffer option mjFB_WINDOW = 0, // default/window buffer mjFB_OFFSCREEN // offscreen buffer } mjtFramebuffer; -typedef enum mjtFontScale_ { // font scale, used at context creation +typedef enum mjtFontScale_ { // font scale, used at context creation mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling mjFONTSCALE_150 = 150, // 150% scale diff --git a/include/mujoco/mjui.h b/include/mujoco/mjui.h index e9a2b0fe..78eadc12 100644 --- a/include/mujoco/mjui.h +++ b/include/mujoco/mjui.h @@ -207,9 +207,9 @@ struct mjuiItemSingle_ { // check and button-related }; -struct mjuiItemMulti_ { // static, radio and select-related - int nelem; // number of elements in group - char name[mjMAXUIMULTI][mjMAXUINAME]; // element names +struct mjuiItemMulti_ { // static, radio and select-related + int nelem; // number of elements in group + char name[mjMAXUIMULTI][mjMAXUINAME]; // element names }; @@ -236,10 +236,10 @@ struct mjuiItem_ { // UI item // type-specific properties union { - struct mjuiItemSingle_ single; // check and button - struct mjuiItemMulti_ multi; // static, radio and select - struct mjuiItemSlider_ slider; // slider - struct mjuiItemEdit_ edit; // edit + struct mjuiItemSingle_ single; // check and button + struct mjuiItemMulti_ multi; // static, radio and select + struct mjuiItemSlider_ slider; // slider + struct mjuiItemEdit_ edit; // edit }; // internal diff --git a/include/mujoco/mjvisualize.h b/include/mujoco/mjvisualize.h index 6b72b2af..818e424d 100644 --- a/include/mujoco/mjvisualize.h +++ b/include/mujoco/mjvisualize.h @@ -16,7 +16,7 @@ #define MUJOCO_MJVISUALIZE_H_ #include -#include + #define mjNGROUP 6 // number of geom, site, joint, skin groups with visflags #define mjMAXLIGHT 100 // maximum number of lights in a scene @@ -339,7 +339,7 @@ struct mjvFigure_ { // abstract 2D figure passed to OpenGL rendere // text labels char title[1000]; // figure title; subplots separated with 2+ spaces char xlabel[100]; // x-axis label - char linename[mjMAXLINE][100]; // line names for legend + char linename[mjMAXLINE][100]; // line names for legend // dynamic settings int legendoffset; // number of lines to offset legend diff --git a/include/mujoco/mujoco.h b/include/mujoco/mujoco.h index 7583992a..9b5723fb 100644 --- a/include/mujoco/mujoco.h +++ b/include/mujoco/mujoco.h @@ -114,13 +114,11 @@ MJAPI void mj_deleteVFS(mjVFS* vfs); // Parse XML file in MJCF or URDF format, compile it, return low-level model. // If vfs is not NULL, look up files in vfs before reading from disk. // If error is not NULL, it must have size error_sz. -MJAPI mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, - char* error, int error_sz); +MJAPI mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, char* error, int error_sz); // Update XML data structures with info from low-level model, save as MJCF. // If error is not NULL, it must have size error_sz. -MJAPI int mj_saveLastXML(const char* filename, const mjModel* m, - char* error, int error_sz); +MJAPI int mj_saveLastXML(const char* filename, const mjModel* m, char* error, int error_sz); // Free last XML model if loaded. Called internally at each load. MJAPI void mj_freeLastXML(void); @@ -786,8 +784,8 @@ MJAPI void mj_deactivate(void); //---------------------------------- Standard math ------------------------------------------------- -#define mjMAX(a,b) (((a) > (b)) ? (a) : (b)) -#define mjMIN(a,b) (((a) < (b)) ? (a) : (b)) +#define mjMAX(a, b) (((a) > (b)) ? (a) : (b)) +#define mjMIN(a, b) (((a) < (b)) ? (a) : (b)) #ifdef mjUSEDOUBLE #define mju_sqrt sqrt