Example #1
0
/*
 * Convert a valid Python signal or slot to an existing universal slot.
 */
void *sipGetRx(sipSimpleWrapper *txSelf, const char *sigargs, PyObject *rxObj,
           const char *slot, const char **memberp)
{
    if (slot != NULL)
        if (isQtSlot(slot) || isQtSignal(slot))
        {
            void *rx;

            *memberp = slot;

            if ((rx = sip_api_get_cpp_ptr((sipSimpleWrapper *)rxObj, sipQObjectType)) == NULL)
                return NULL;

            if (isQtSignal(slot))
                rx = findSignal(rx, memberp);

            return rx;
        }

    /*
     * The slot was either a Python callable or PyQt3 Python signal so there
     * should be a universal slot.
     */
    return sipQtSupport->qt_find_slot(sip_api_get_address(txSelf), sigargs, rxObj, slot, memberp);
}
Example #2
0
/*
 * Return a usable signal, creating a new universal signal if needed.
 */
static void *newSignal(void *txrx, const char **sig)
{
    void *new_txrx = findSignal(txrx, sig);

    if (new_txrx == NULL && sipQtSupport->qt_create_universal_signal != NULL)
        new_txrx = sipQtSupport->qt_create_universal_signal(txrx, sig);

    return new_txrx;
}
Example #3
0
/*--------------------------------------------------------------calcPFTL1()
 * Nodelay flag=1 -> no delay available
 * pf signal imediately follows inta 
 * used on L0 board
 * boffset: there is difference in offset when int1/2 generated in outgen mode
 *          and when generated by BC/RND: it is since int1/2 is comming from
 *          L0 ssm.
 */ 
int calcPFTL1(int board1,int board2,int ipf,int boffset){
 int ret0=Mega,ret=1;
 int start,w;
 int scalea,scaleb;
 int amin,bmin;
 int offset;
 w32 scale;
 Signal *spf1,*sint1,*sint2;
 int ic=0;

 //if(!sms[TEST].sm)sms[TEST].sm = (w32 *) malloc(Mega*sizeof(w32));
 if(!sms[TEST].sm)sms[TEST].sm=TestSSM;
 //spf1=findSignalS(board,0,"pf1");
 // pf1 .. pft = (69 .. 73)
 spf1=findSignal(board2,68+ipf,"pfx");
 sint1=findSignalS(board1,0,"int1");
 sint2=findSignalS(board1,0,"int2");
 printf("calcPFTL1: int1 int2 channels= %i %i \n",sint1->channel,sint2->channel); 
 //offset=sms[board1].offset-sms[board2].offset-1;
 offset=sms[board1].offset-sms[board2].offset-boffset;
 printf("calcPFTL1: offset= %i %i %i\n",offset,sms[board1].offset,sms[board2].offset); 
 sms[TEST].offset=sms[board1].offset-1;  // -1 is for pedja !
 
 if(HardWare.scaleA > HardWare.scaleB) scale=HardWare.scaleA;
 else scale=HardWare.scaleB;
 
 start=sms[board1].offset+(scale+1)*256+256;
 printf("calcPFTL1: start=%i \n",start);
 scaleb=0;
 while((ret) && scaleb<(HardWare.scaleB+1)){
 scalea=0;
   while((ret) && scalea<(HardWare.scaleA+1)){
     w = PFcircuit3(board1,ipf,scalea,scaleb,sint1->channel,sint2->channel,sms[board1].offset,ic);
     printf("scalea scaleb w %i %i %i \n",scalea,scaleb,w);
     ret=compSIG3(sms[board2].sm,spf1->channel,TEST,5*ic,offset,start);
     //ret=compSIG3(sms[TEST].sm,ipf-1,board2,spf1->channel,offset,start);
     //ret=compSIG3(sms[TEST].sm,5*ic,board2,spf1->channel,offset,start);
     //ic++;
     if(ret < ret0){ amin=scalea;bmin=scaleb;ret0=ret;}
     scalea++;
   } 
   scaleb++;
 }
 if(!ret) printf("testPF: SUCCES \n");
 else{
   printf("testPF: FAIL amin=%i bmin=%i \n",amin,bmin);
   //PFcircuit(board1,ipf,amin,bmin,sint1->channel,sint2->channel);
   //ret=compSIG4(sms[TEST].sm,0,board2,spf1->channel,0,start,1);
   //HardWare.loop=0;
   //printPFHW(); 
   return ret;
 }
 //sms[board].offset=start;
 //sms[TEST].offset=start;
 return ret;
}
Example #4
0
/*
 * Disconnect a signal to a signal or a Qt slot.
 */
PyObject *sip_api_disconnect_rx(PyObject *txObj,const char *sig,
                PyObject *rxObj,const char *slot)
{
    assert(sipQtSupport);
    assert(sipQtSupport->qt_disconnect);
    assert(sipQtSupport->qt_destroy_universal_slot);

    /* Handle Qt signals. */
    if (isQtSignal(sig))
    {
        sipSimpleWrapper *txSelf = (sipSimpleWrapper *)txObj;
        void *tx, *rx;
        const char *member;
        int res;

        if ((tx = sip_api_get_cpp_ptr(txSelf, sipQObjectType)) == NULL)
            return NULL;

        if ((rx = sipGetRx(txSelf, sig, rxObj, slot, &member)) == NULL)
        {
            Py_INCREF(Py_False);
            return Py_False;
        }

        /* Handle Python signals. */
        tx = findSignal(tx, &sig);

        res = sipQtSupport->qt_disconnect(tx, sig, rx, member);

        /*
         * Delete it if it is a universal slot as this will be it's only
         * connection.  If the slot is actually a universal signal then it
         * should leave it in place.
         */
        sipQtSupport->qt_destroy_universal_slot(rx);

        return PyBool_FromLong(res);
    }

    /* Handle Python signals.  Only PyQt3 will get this far. */
    assert(sipQtSupport->qt_disconnect_py_signal);

    sipQtSupport->qt_disconnect_py_signal(txObj, sig, rxObj, slot);

    Py_INCREF(Py_True);
    return Py_True;
}
Example #5
0
int
findHoldKillSig( ClassAd* ad )
{
	return findSignal( ad, ATTR_HOLD_KILL_SIG );
}
Example #6
0
int
findRmKillSig( ClassAd* ad )
{
	return findSignal( ad, ATTR_REMOVE_KILL_SIG );
}
Example #7
0
int
findSoftKillSig( ClassAd* ad )
{
	return findSignal( ad, ATTR_KILL_SIG );
}
Example #8
0
int
findCheckpointSig( ClassAd* ad )
{
    return findSignal( ad, ATTR_CHECKPOINT_SIG );
}