mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Add format script which invokes clang-format on the C++ source code (#41)
On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
committed by
Peter Johnson
parent
68690643d2
commit
e14e45da76
@@ -6,8 +6,8 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <jni.h>
|
||||
#include "Log.hpp"
|
||||
#include "HAL/HAL.hpp"
|
||||
#include "Log.hpp"
|
||||
|
||||
#include "edu_wpi_first_wpilibj_hal_SolenoidJNI.h"
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
|
||||
TLogLevel solenoidJNILogLevel = logERROR;
|
||||
|
||||
#define SOLENOIDJNI_LOG(level) \
|
||||
if (level > solenoidJNILogLevel) ; \
|
||||
else Log().Get(level)
|
||||
#define SOLENOIDJNI_LOG(level) \
|
||||
if (level > solenoidJNILogLevel) \
|
||||
; \
|
||||
else \
|
||||
Log().Get(level)
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -26,26 +28,30 @@ extern "C" {
|
||||
* Method: initializeSolenoidPort
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort
|
||||
(JNIEnv *env, jclass, jlong port_pointer)
|
||||
{
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort";
|
||||
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Port Ptr = " << (void*)port_pointer;
|
||||
char *aschars = (char *)port_pointer;
|
||||
SOLENOIDJNI_LOG(logDEBUG) << '\t' << (int)aschars[0] << '\t' << (int)aschars[1] << std::endl;
|
||||
|
||||
int32_t status = 0;
|
||||
void* solenoid_port_pointer = initializeSolenoidPort((void*)port_pointer, &status);
|
||||
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Pointer = " << solenoid_port_pointer;
|
||||
|
||||
int *asints = (int *)solenoid_port_pointer;
|
||||
SOLENOIDJNI_LOG(logDEBUG) << '\t' << asints[0] << '\t' << asints[1] << std::endl;
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSolenoidPort(
|
||||
JNIEnv *env, jclass, jlong port_pointer) {
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort";
|
||||
|
||||
CheckStatus(env, status);
|
||||
return (jlong)solenoid_port_pointer;
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Port Ptr = " << (void *)port_pointer;
|
||||
char *aschars = (char *)port_pointer;
|
||||
SOLENOIDJNI_LOG(logDEBUG) << '\t' << (int)aschars[0] << '\t'
|
||||
<< (int)aschars[1] << std::endl;
|
||||
|
||||
int32_t status = 0;
|
||||
void *solenoid_port_pointer =
|
||||
initializeSolenoidPort((void *)port_pointer, &status);
|
||||
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Pointer = "
|
||||
<< solenoid_port_pointer;
|
||||
|
||||
int *asints = (int *)solenoid_port_pointer;
|
||||
SOLENOIDJNI_LOG(logDEBUG) << '\t' << asints[0] << '\t' << asints[1]
|
||||
<< std::endl;
|
||||
|
||||
CheckStatus(env, status);
|
||||
return (jlong)solenoid_port_pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -53,13 +59,13 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_initializeSol
|
||||
* Method: freeSolenoidPort
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort
|
||||
(JNIEnv *env, jclass, jlong id)
|
||||
{
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort";
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPort(
|
||||
JNIEnv *env, jclass, jlong id) {
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI initializeSolenoidPort";
|
||||
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Port Ptr = " << (void*)id;
|
||||
freeSolenoidPort((void*)id);
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Port Ptr = " << (void *)id;
|
||||
freeSolenoidPort((void *)id);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -67,12 +73,12 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_freeSolenoidPo
|
||||
* Method: getPortWithModule
|
||||
* Signature: (BB)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPortWithModule
|
||||
(JNIEnv *env, jclass, jbyte module, jbyte channel)
|
||||
{
|
||||
void* port_pointer = getPortWithModule(module, channel);
|
||||
|
||||
return (jlong)port_pointer;
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPortWithModule(
|
||||
JNIEnv *env, jclass, jbyte module, jbyte channel) {
|
||||
void *port_pointer = getPortWithModule(module, channel);
|
||||
|
||||
return (jlong)port_pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -80,16 +86,16 @@ JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPortWithMo
|
||||
* Method: setSolenoid
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid
|
||||
(JNIEnv *env, jclass, jlong solenoid_port, jboolean value)
|
||||
{
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetSolenoid";
|
||||
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Pointer = " << (void*)solenoid_port;
|
||||
|
||||
int32_t status = 0;
|
||||
setSolenoid((void*)solenoid_port, value, &status);
|
||||
CheckStatus(env, status);
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid(
|
||||
JNIEnv *env, jclass, jlong solenoid_port, jboolean value) {
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Calling SolenoidJNI SetSolenoid";
|
||||
|
||||
SOLENOIDJNI_LOG(logDEBUG) << "Solenoid Port Pointer = "
|
||||
<< (void *)solenoid_port;
|
||||
|
||||
int32_t status = 0;
|
||||
setSolenoid((void *)solenoid_port, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -97,13 +103,13 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_setSolenoid
|
||||
* Method: getSolenoid
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid
|
||||
(JNIEnv *env, jclass, jlong solenoid_port)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jboolean val = getSolenoid((void*)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoid(
|
||||
JNIEnv *env, jclass, jlong solenoid_port) {
|
||||
int32_t status = 0;
|
||||
jboolean val = getSolenoid((void *)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -111,13 +117,13 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getSolenoi
|
||||
* Method: getAllSolenoids
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids
|
||||
(JNIEnv *env, jclass, jlong solenoid_port)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jbyte val = getAllSolenoids((void*)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
JNIEXPORT jbyte JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoids(
|
||||
JNIEnv *env, jclass, jlong solenoid_port) {
|
||||
int32_t status = 0;
|
||||
jbyte val = getAllSolenoids((void *)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -125,51 +131,51 @@ JNIEXPORT jbyte JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getAllSolenoi
|
||||
* Method: getPCMSolenoidBlackList
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList
|
||||
(JNIEnv *env, jclass, jlong solenoid_port)
|
||||
{
|
||||
int32_t status = 0;
|
||||
jint val = getPCMSolenoidBlackList((void*)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidBlackList(
|
||||
JNIEnv *env, jclass, jlong solenoid_port) {
|
||||
int32_t status = 0;
|
||||
jint val = getPCMSolenoidBlackList((void *)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_SolenoidJNI
|
||||
* Method: getPCMSolenoidVoltageStickyFault
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault
|
||||
(JNIEnv *env, jclass, jlong solenoid_port)
|
||||
{
|
||||
int32_t status = 0;
|
||||
bool val = getPCMSolenoidVoltageStickyFault((void*)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageStickyFault(
|
||||
JNIEnv *env, jclass, jlong solenoid_port) {
|
||||
int32_t status = 0;
|
||||
bool val = getPCMSolenoidVoltageStickyFault((void *)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_SolenoidJNI
|
||||
* Method: getPCMSolenoidVoltageFault
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault
|
||||
(JNIEnv *env, jclass, jlong solenoid_port)
|
||||
{
|
||||
int32_t status = 0;
|
||||
bool val = getPCMSolenoidVoltageFault((void*)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_getPCMSolenoidVoltageFault(
|
||||
JNIEnv *env, jclass, jlong solenoid_port) {
|
||||
int32_t status = 0;
|
||||
bool val = getPCMSolenoidVoltageFault((void *)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
/*
|
||||
* Class: edu_wpi_first_wpilibj_hal_SolenoidJNI
|
||||
* Method: clearAllPCMStickyFaults
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults
|
||||
(JNIEnv *env, jclass, jlong solenoid_port)
|
||||
{
|
||||
int32_t status = 0;
|
||||
clearAllPCMStickyFaults_sol((void*)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_wpilibj_hal_SolenoidJNI_clearAllPCMStickyFaults(
|
||||
JNIEnv *env, jclass, jlong solenoid_port) {
|
||||
int32_t status = 0;
|
||||
clearAllPCMStickyFaults_sol((void *)solenoid_port, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user