artf2612: Added Python script for updating license in source files (#57)

This is a follow-up of 3cd1253. A C++ program was written to automate the license update originally. That program was translated to Python so it can be kept in the repository and run when needed. It has been tested on Windows using the standard Python 3 installation and on Linux.

The original version skipped files that had "//" at the beginning since most were files that should be excluded. The relevant files are now in an exclusion list and the rest are processed normally. The .hpp file extension has been added as well. The script rewrote CompressorJNI.cpp to remove the carriage returns from its line endings.
This commit is contained in:
Tyler Veness
2016-05-25 20:23:37 -07:00
committed by Peter Johnson
parent e63830ed21
commit 74f9da9da1
37 changed files with 575 additions and 214 deletions

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
enum AccelerometerRange {

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,7 +1,9 @@
/**
* Compressor.h
* Methods for interacting with a compressor with the CAN PCM device
*/
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#define CTR_RxTimeout_MESSAGE "CTRE CAN Recieve Timeout"

View File

@@ -1,8 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2013. All Rights Reserved. */
/* Copyright (c) FIRST 2013-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "cpp/priority_condition_variable.h"

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <pthread.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,9 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.
*/
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdint.h>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <condition_variable>

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <stdio.h>

View File

@@ -1,5 +1,13 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
// This file must compile on ALL PLATFORMS. Be very careful what you put in
// here.
#include "HAL/HAL.h"
#include <cstring>
#include "FRC_NetworkCommunication/FRCComm.h"

View File

@@ -1 +1,8 @@
// nothing here yet!
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
// nothing here yet!

131
license-update.py Executable file
View File

@@ -0,0 +1,131 @@
#!/usr/bin/env python3
# If there is already a comment block, a year range through the current year is
# created using the first year in the comment. If there is no comment block, a
# new one is added containing just the current year.
from datetime import date
import os
import re
sep = os.sep
# If directory separator is backslash, escape it for regexes
if sep == "\\":
sep += "\\"
# Files and directories which should be included in or excluded from the update
regexInclude = re.compile("\.cpp$|\.h$|\.hpp$|\.inc$|\.java$")
folderExclude = "build" + sep + "|\.git" + sep + "|gradle" + sep + \
"|\.gradle" + sep + "|ni-libraries" + sep + "|ctre" + sep + \
"|frccansae" + sep + "|FRC_FPGA_ChipObject" + sep + \
"|gtest" + sep + "|msgs" + sep + "|i2clib" + sep + \
"|NetworkCommunication" + sep + "|ni" + sep + \
"|spilib" + sep + "|visa" + sep
regexExclude = re.compile(folderExclude +
"|NIIMAQdx\.h$|nivision\.h$|NIVisionJNI\.cpp$|"
"can_proto\.h$|jni\.h$|jni_md\.h$")
currentYear = str(date.today().year)
# Recursively create list of files in given directory
files = [os.path.join(dp, f) for dp, dn, fn in
os.walk(os.path.expanduser(".")) for f in fn]
# Apply regex filters to list
files = [f for f in files if regexInclude.search(f)]
files = [f for f in files if not regexExclude.search(f)]
if not files:
print("Error: no files to format", file=sys.stderr)
sys.exit(1)
for name in files:
# List names of files as they are processed if verbose flag was given
if len(sys.argv) > 1 and sys.argv[1] == "-v":
print("Processing", name,)
with open(name, "r", encoding = "ISO-8859-1") as file:
modifyCopyright = False
year = ""
# Get first line of file
line = file.readline()
# If first line is copyright comment
if line[0:2] == "/*":
modifyCopyright = True
# Get next line
line = file.readline()
# Search for start of copyright year
pos = line.find("20")
# Extract it if found
if pos != -1:
year = line[pos:pos + 4]
else:
continue
# Retrieve lines until one past end of comment block
inComment = True
inBlock = True
while inBlock:
if not inComment:
pos = line.find("/*", pos)
if pos != -1:
inComment = True
else:
inBlock = False
else:
pos = line.find("*/", pos)
if pos != -1:
inComment = False
# This assumes no comments are started on the same line after
# another ends
line = file.readline()
pos = 0
with open(name + ".tmp", "w", encoding = "ISO-8859-1") as temp:
# Write first line of comment
temp.write("/*")
for i in range(0, 76):
temp.write("-")
temp.write("*/\n")
# Write second line of comment
temp.write("/* Copyright (c) FIRST ")
if modifyCopyright and year != currentYear:
temp.write(year)
temp.write("-")
temp.write(currentYear)
temp.write(". All Rights Reserved.")
for i in range(0, 24):
temp.write(" ")
if not modifyCopyright or year == currentYear:
for i in range(0, 5):
temp.write(" ")
temp.write("*/\n")
# Write rest of lines of comment
temp.write("/* Open Source Software - may be modified and shared by FRC teams. The code */\n"
"/* must be accompanied by the FIRST BSD license file in the root directory of */\n"
"/* the project. */\n"
"/*")
for i in range(0, 76):
temp.write("-")
temp.write("*/\n")
# If line after comment block isn't empty
if len(line) > 1 and line[0] != " ":
temp.write("\n")
temp.write(line)
# Copy rest of original file into new one
for line in file:
temp.write(line)
# Replace old file
os.remove(name)
os.rename(name + ".tmp", name)

View File

@@ -1,204 +1,204 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include "HAL/HAL.h"
#include "HALUtil.h"
#include "Log.h"
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.h"
extern "C" {
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: initializeCompressor
* Signature: (B)J
*/
JNIEXPORT jlong JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor(
JNIEnv *env, jclass, jbyte module) {
void *pcm = initializeCompressor(module);
return (jlong)pcm;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: checkCompressorModule
* Signature: (B)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule(
JNIEnv *env, jclass, jbyte module) {
return checkCompressorModule(module);
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressor
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressor((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: setClosedLoopControl
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setClosedLoopControl(
JNIEnv *env, jclass, jlong pcm_pointer, jboolean value) {
int32_t status = 0;
setClosedLoopControl((void *)pcm_pointer, value, &status);
CheckStatus(env, status);
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getClosedLoopControl
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getClosedLoopControl(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getClosedLoopControl((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getPressureSwitch
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getPressureSwitch(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getPressureSwitch((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrent
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
float val = getCompressorCurrent((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrentTooHighFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorCurrentTooHighFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrentTooHighStickyFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val =
getCompressorCurrentTooHighStickyFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorShortedStickyFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorShortedStickyFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorShortedFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorShortedFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorNotConnectedStickyFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorNotConnectedStickyFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorNotConnectedFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorNotConnectedFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: clearAllPCMStickyFaults
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
clearAllPCMStickyFaults((void *)pcm_pointer, &status);
CheckStatus(env, status);
}
} // extern "C"
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include "HAL/HAL.h"
#include "HALUtil.h"
#include "Log.h"
#include "edu_wpi_first_wpilibj_hal_CompressorJNI.h"
extern "C" {
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: initializeCompressor
* Signature: (B)J
*/
JNIEXPORT jlong JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_initializeCompressor(
JNIEnv *env, jclass, jbyte module) {
void *pcm = initializeCompressor(module);
return (jlong)pcm;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: checkCompressorModule
* Signature: (B)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_checkCompressorModule(
JNIEnv *env, jclass, jbyte module) {
return checkCompressorModule(module);
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressor
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressor(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressor((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: setClosedLoopControl
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_setClosedLoopControl(
JNIEnv *env, jclass, jlong pcm_pointer, jboolean value) {
int32_t status = 0;
setClosedLoopControl((void *)pcm_pointer, value, &status);
CheckStatus(env, status);
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getClosedLoopControl
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getClosedLoopControl(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getClosedLoopControl((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getPressureSwitch
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getPressureSwitch(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getPressureSwitch((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrent
* Signature: (J)F
*/
JNIEXPORT jfloat JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrent(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
float val = getCompressorCurrent((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrentTooHighFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorCurrentTooHighFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorCurrentTooHighStickyFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorCurrentTooHighStickyFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val =
getCompressorCurrentTooHighStickyFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorShortedStickyFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedStickyFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorShortedStickyFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorShortedFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorShortedFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorShortedFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorNotConnectedStickyFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedStickyFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorNotConnectedStickyFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: getCompressorNotConnectedFault
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_getCompressorNotConnectedFault(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
bool val = getCompressorNotConnectedFault((void *)pcm_pointer, &status);
CheckStatus(env, status);
return val;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CompressorJNI
* Method: clearAllPCMStickyFaults
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpilibj_hal_CompressorJNI_clearAllPCMStickyFaults(
JNIEnv *env, jclass, jlong pcm_pointer) {
int32_t status = 0;
clearAllPCMStickyFaults((void *)pcm_pointer, &status);
CheckStatus(env, status);
}
} // extern "C"

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.livewindow;
/**

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
/**

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
import org.junit.After;

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
import com.google.common.base.Stopwatch;