add bool in code

This commit is contained in:
quentin.perret 2022-06-09 17:56:45 +02:00
parent 446d3b5fd7
commit 46e02c1d6d
9 changed files with 15 additions and 32 deletions

5
Code-C/.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"files.associations": {
"power.h": "c"
}
}

View file

@ -57,11 +57,11 @@ void printArrayData(long** p, int N, int M) {
* @param M
* @return int
*/
int checkArrayFullyFill(long **p, int N , int M){
bool checkArrayFullyFill(long **p, int N , int M){
for(int i = 0 ; i < N ; i++){
if(p[i][0] == '\0'){ return 1; }
if(p[i][0] == '\0'){ return false; }
}
return 0;
return true;
}
void freeArray(long **p, int N) {

View file

@ -2,9 +2,10 @@
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <inttypes.h>
long **getRawDataArray();
void printArrayData(long** p, int N, int M);
void freeArray(long **p, int N);
int checkArrayFullyFill(long **p, int N , int M);
bool checkArrayFullyFill(long **p, int N , int M);

BIN
Code-C/main Executable file

Binary file not shown.

View file

@ -21,5 +21,5 @@ int main(int argc , char** argv){
pthread_t rawData;
pthread_create(&rawData , NULL, simulateFlux, (void *)&rawData);
pthread_exit(NULL);
while(power(nRow,nCol,period,invTimeBandWidth)==0){}
while(power(nRow,nCol,period,invTimeBandWidth)){}
}

View file

@ -16,17 +16,16 @@ void powerCalculation(long **p, double powerArray[] , int N, int M , double peri
//printf("%f\n", powerArray[i]);
}
}
int power(int N , int M, double periode , double invTimeBandwidth){
bool power(int N , int M, double periode , double invTimeBandwidth){
long **p = getRawDataArray(N, M);
//printArrayData(p,N,M);
double pw[8];
if(p !=NULL){
powerCalculation(p,pw,N,M,periode,invTimeBandwidth);
writePowerData(pw,8);
freeArray(p,N);
return 0;
return true;
}
else{
return 1;
return false;
}
}

View file

@ -1,3 +1,4 @@
#include <math.h>
#include <stdbool.h>
int power(int N , int M, double periode , double timeBandwidth);

View file

@ -1,24 +1,8 @@
#include "simulateFlux.h"
#include "initialParameters.h"
typedef struct {
char *fileName;
} nameFill;
typedef struct {
nameFill curentFile;
nameFill *nextFile;
}rawDataFile;
nameFill getNameFill(int N){
nameFill file;
file.fileName = (char *) malloc(N*sizeof(char *));
return file;
}
int cptData = 0;
int cptFile = 1;
nameFill FirstFile;
char* convertIntegerToChar(int N)
{

View file

@ -13,12 +13,5 @@ typedef struct {
uint8_t octet4;
} quartet;
extern struct nameFill;
extern struct rawDataFile;
nameFill getNameFill(int N);
bool writeOneRawData(FILE *f);
void *simulateFlux(void *vargp);