예제 #1
0
파일: Alg.hpp 프로젝트: ajtowns/snarkfront
 Alg(const T& a, const bool blessed)
     : m_value(a),
       m_witness(valueToString(VAL(a))),
       m_splitBits(valueBits(VAL(a)))
 {
     initTerms(blessed);
 }
예제 #2
0
void serialReceiveInit(int verbose, int settings){
    isSudo(); // check for proper permissions
    char *pathname = getPath(); // get name of device
    int fdUSB = myOpen(pathname); // get file descriptor
    if(!isatty(fdUSB)){printf("not a terminal device: %i\n\t%s\n",fdUSB,strerror(errno));}
    
    // get current attributes
    struct termios config;
    int attrFlag = tcgetattr(fdUSB,&config);
    if (attrFlag<0){printf("serialReceiveInit: tcgetattr: %s\n",strerror(errno));}
    if (verbose){
        printf("Initial (default) attributes:\n");
        printTermistruct(config);
    }

    // set baud rate
    int BRFlag = setBaudRate(fdUSB,config);
    if (BRFlag<0){printf("Baud rate mismatch\n");}
    
    // initialize attributes
    config = initTerms(fdUSB,config,settings);

    // set attributes
    config = setTerms(fdUSB,config);
    if (verbose){
        printf("New attributes\n");
        printTermistruct(config);
    }
}
예제 #3
0
파일: Alg.hpp 프로젝트: ajtowns/snarkfront
    void bless(const T& a) {
        // object is not already initialized
#ifdef USE_ASSERT
        assert(m_splitBits.empty());
        assert(m_r1Terms.empty());
#endif

        m_value = VAL(a);
        m_witness = FR(valueToString(VAL(a)));
        m_splitBits = valueBits(VAL(a));

        initTerms(true);
    }