void ViewCameraGL::read(const QString& filename) { QFile file(filename); if(file.exists() && file.open( QIODevice::ReadOnly )) { QTextStream stream ( &file ); stream >> __azimuth >> __elevation; printf("%d\n",__azimuth); printf("%d\n",__elevation); stream >> __stepMove; printf("%i\n",__stepMove); IV(stream,__center); IV(stream,__eye); IV(stream,__translation); stream >> __radius >> __far_plane >> __near_plane; stream >> __default_view_angle >> __view_angle; int i = 0; stream >> i; __projectionmode = (i != 0); stream >> i; __geomsys = (i != 0); // emit azimuthChanged(QString::number(__azimuth)); // emit elevationChanged(QString::number(__elevation)); // emit zoomChanged(QString::number(__translation.x())); emit azimuthChanged(__azimuth); emit elevationChanged(__elevation); emit zoomChanged(__translation.x()); emit farPlaneChanged(QString::number(__far_plane)); emit nearPlaneChanged(QString::number(__near_plane)); emit projectionChanged(__projectionmode); emit coordSysChanged(__geomsys); emit valueChanged(); }
bool MatrixRmn::DebugCheckSVD( const MatrixRmn& U, const VectorRn& w, const MatrixRmn& V ) const { // Special SVD test code MatrixRmn IV( V.GetNumRows(), V.GetNumColumns() ); IV.SetIdentity(); MatrixRmn VTV( V.GetNumRows(), V.GetNumColumns() ); MatrixRmn::TransposeMultiply( V, V, VTV ); IV -= VTV; double error = IV.FrobeniusNorm(); MatrixRmn IU( U.GetNumRows(), U.GetNumColumns() ); IU.SetIdentity(); MatrixRmn UTU( U.GetNumRows(), U.GetNumColumns() ); MatrixRmn::TransposeMultiply( U, U, UTU ); IU -= UTU; error += IU.FrobeniusNorm(); MatrixRmn Diag( U.GetNumRows(), V.GetNumRows() ); Diag.SetZero(); Diag.SetDiagonalEntries( w ); MatrixRmn B(U.GetNumRows(), V.GetNumRows() ); MatrixRmn C(U.GetNumRows(), V.GetNumRows() ); MatrixRmn::Multiply( U, Diag, B ); MatrixRmn::MultiplyTranspose( B, V, C ); C -= *this; error += C.FrobeniusNorm(); bool ret = ( fabs(error)<=1.0e-13*w.MaxAbs() ); assert ( ret ); return ret; }
census_run_result run_census_in_series::operator() (fs::path const& file ,mcenum_emission const emission ,std::vector<Input> const& cells ,Ledger & composite ) { Timer timer; census_run_result result; boost::shared_ptr<progress_meter> meter (create_progress_meter (cells.size() ,"Calculating all cells" ,progress_meter_mode(emission) ) ); ledger_emitter emitter(file, emission); result.seconds_for_output_ += emitter.initiate(); for(unsigned int j = 0; j < cells.size(); ++j) { if(!cell_should_be_ignored(cells[j])) { std::string const name(cells[j]["InsuredName"].str()); IllusVal IV(serial_file_path(file, name, j, "hastur").string()); IV.run(cells[j]); composite.PlusEq(*IV.ledger()); result.seconds_for_output_ += emitter.emit_cell (serial_file_path(file, name, j, "hastur") ,*IV.ledger() ); meter->dawdle(intermission_between_printouts(emission)); } if(!meter->reflect_progress()) { result.completed_normally_ = false; goto done; } } meter->culminate(); result.seconds_for_output_ += emitter.emit_cell (serial_file_path(file, "composite", -1, "hastur") ,composite ); result.seconds_for_output_ += emitter.finish(); done: double total_seconds = timer.stop().elapsed_seconds(); status() << Timer::elapsed_msec_str(total_seconds) << std::flush; result.seconds_for_calculations_ = total_seconds - result.seconds_for_output_; return result; }
const IV nearest_point_index(const RV & coord) { #if 0 IV np(static_cast<int>(floor((coord[0]+.5*lx_)/deltax_)), static_cast<int>(floor((coord[1]+.5*ly_)/deltay_)), static_cast<int>(floor((coord[2]+.5*lz_)/deltaz_))); RV dist=coord-coordinates(np[0],np[1],np[2]); for(int n=0;n<3;++n) if(dist[n]>=.5*deltal(n)) np[n]+=1; return np; #endif return IV(static_cast<int>(round((coord[0]+.5*lx_)/deltax_))%nx_, static_cast<int>(round((coord[1]+.5*ly_)/deltay_))%ny_, static_cast<int>(round((coord[2]+.5*lz_)/deltaz_))%nz_); };
void CTwofishModule::decrypt(Tools::CSecureMemory &rPlainText, Tools::CSecureMemory const &rCypherText) const { FASSERT(mKey.getSize() == gKeySize); FASSERT(((rCypherText.getSize() - gIVSize) % gBlockSize) == 0); Tools::CSecureMemory IV(&rCypherText[0], gIVSize); CBC_Mode<Twofish>::Decryption Cipher; Cipher.SetKeyWithIV(&mKey[0], mKey.getSize(), &IV[0], IV.getSize()); rPlainText.CSecureMemory::allocate(rCypherText.getSize() - IV.getSize()); Cipher.ProcessData(&rPlainText[0], &rCypherText[IV.getSize()], rPlainText.getSize()); ASSERT((rPlainText.getSize() % gBlockSize) == 0); return; }
void dijkstra(int src, IV &dis) { set<II> q; dis = IV(n, INF); BV vis(n); q.insert(II(0, src)); dis[src] = 0; while (! q.empty()) { II p = *(q.begin()); q.erase(q.begin()); int d = p.first, v = p.second; if (vis[v]) continue; vis[v] = true; For (EL, e, adj[v]) { int d2 = d + e->w; if (d2 < dis[e->v]) { dis[e->v] = d2; q.insert(II(d2, e->v)); } } }
QVector<bit16> Full_CBC_SAES_Decrypt(QVector<bit16> CTVectorInv, bit16 Key16Inv) { int LInv = CTVectorInv.size(); QVector<bit16> PTVectorInv; QVector<bit16> KeyExpansionInv = ExpandKey(Key16Inv); bit16 IV(std::string("0001011111010011")); bit16 ForNextRoundInv = IV; for(int i=0; i<LInv; i++) { bit16 CiphertextInv = CTVectorInv[i]; bit16 TempInv = SAES_Decrypt(KeyExpansionInv, CiphertextInv); bit16 PTPieceInv = TempInv ^ ForNextRoundInv; PTVectorInv.push_back(PTPieceInv); ForNextRoundInv = CiphertextInv; } return PTVectorInv; }
QVector<bit16> Full_CBC_SAES_Encrypt(QVector<bit16> PTVector, bit16 Key16) { int L = PTVector.size(); QVector<bit16> CTVector; QVector<bit16> KeyExpansion = ExpandKey(Key16); bit16 IV(std::string("0001011111010011")); //backwards because of Endian conversion bit16 ForNextRound = IV; for(int i=0; i<L; i++) { bit16 Plaintext = PTVector[i]; bit16 InputToSAES = ForNextRound ^ Plaintext; ForNextRound = SAES_Encrypt(KeyExpansion, InputToSAES); CTVector.push_back(ForNextRound); } return CTVector; }
size_t SpatialEdge::newEdge(size_t emindex, size_t index, int k) { Edge *en, *em; size_t swap; em = &edges_[emindex]; switch (k) { case 0: em->start_ = IV(1); em->end_ = IV(2); break; case 1: em->start_ = IV(0); em->end_ = IV(2); break; case 2: em->start_ = IV(0); em->end_ = IV(1); break; } // sort the vertices by increasing index if(em->start_ > em->end_) { swap = em->start_; em->start_ = em->end_; em->end_ = swap; } // check all previous edges for a match, return pointer if // already present, log the midpoint with the new face as well if( (en=edgeMatch(em)) != NULL){ IW(k) = en->mid_; return emindex; } // this is a new edge, immediately process the midpoint, // and save it with the nodes and the edge as well insertLookup(em); IW(k) = getMidPoint(em); em->mid_ = IW(k); return ++emindex; }
bool MatrixRmn::DebugCalcBidiagCheck( const MatrixRmn& U, const VectorRn& w, const VectorRn& superDiag, const MatrixRmn& V ) const { // Special SVD test code MatrixRmn IV( V.GetNumRows(), V.GetNumColumns() ); IV.SetIdentity(); MatrixRmn VTV( V.GetNumRows(), V.GetNumColumns() ); MatrixRmn::TransposeMultiply( V, V, VTV ); IV -= VTV; double error = IV.FrobeniusNorm(); MatrixRmn IU( U.GetNumRows(), U.GetNumColumns() ); IU.SetIdentity(); MatrixRmn UTU( U.GetNumRows(), U.GetNumColumns() ); MatrixRmn::TransposeMultiply( U, U, UTU ); IU -= UTU; error += IU.FrobeniusNorm(); MatrixRmn DiagAndSuper( U.GetNumRows(), V.GetNumRows() ); DiagAndSuper.SetZero(); DiagAndSuper.SetDiagonalEntries( w ); if ( this->GetNumRows()>=this->GetNumColumns() ) { DiagAndSuper.SetSequence( superDiag, 0, 1, 1, 1 ); } else { DiagAndSuper.SetSequence( superDiag, 1, 0, 1, 1 ); } MatrixRmn B(U.GetNumRows(), V.GetNumRows() ); MatrixRmn C(U.GetNumRows(), V.GetNumRows() ); MatrixRmn::Multiply( U, DiagAndSuper, B ); MatrixRmn::MultiplyTranspose( B, V, C ); C -= *this; error += C.FrobeniusNorm(); bool ret = ( fabs(error)<1.0e-13*Max(w.MaxAbs(),superDiag.MaxAbs()) ); assert ( ret ); return ret; }
answer(getArgChain(b->members, toInt(valInt(n)-s))); } } /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ /* Instance Variables */ static vardecl var_block[] = { IV(NAME_parameters, "code_vector*", IV_BOTH, NAME_argument, "Vector with formal parameters") }; /* Send Methods */ static senddecl send_block[] = { SM(NAME_initialise, 1, "var|code ...", initialiseBlockv, DEFAULT, "Create from parameters and statements"), SM(NAME_forward, 1, "any ...", forwardBlockv, NAME_execute, "Push <-parameters, @arg1 ... and execute") }; /* Get Methods */ static getdecl get_block[] = { GM(NAME_Arg, 1, "code", "int", getArgBlock,
/******************************* * CLASS DECLARATION * *******************************/ /* Type declaractions */ static char *T_initialise[] = { "width=[int]", "ascent=[int]", "descent=[int]", "rubber=[rubber]*" }; /* Instance Variables */ static vardecl var_hbox[] = { IV(NAME_width, "int", IV_GET, NAME_dimension, "Natural width of content"), IV(NAME_ascent, "0..", IV_GET, NAME_dimension, "Heigth above baseline"), IV(NAME_descent, "0..", IV_GET, NAME_dimension, "Depth below baseline"), IV(NAME_rubber, "rubber*", IV_GET, NAME_layout, "Stretch/shrinkability") }; /* Send Methods */ static senddecl send_hbox[] = { SM(NAME_initialise, 4, T_initialise, initialiseHBox, DEFAULT, "Create hbox from dimensions") };
{ return nameReferenceObject(a->object, a->reference); } /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "reference=name", "object=object|function" }; /* Instance Variables */ static vardecl var_assoc[] = { IV(NAME_reference, "name", IV_BOTH, NAME_reference, "Reference to give to the object"), IV(NAME_object, "object|function", IV_BOTH, NAME_reference, "Object to assign reference") }; /* Send Methods */ static senddecl send_assoc[] = { SM(NAME_Execute, 0, NULL, ExecuteAssoc, DEFAULT, "Assign the reference"), SM(NAME_initialise, 2, T_initialise, initialiseAssoc, DEFAULT, "Create from reference and object") }; /* Get Methods */
} /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "left=any|function", "right=any|function" }; /* Instance Variables */ static vardecl var_equal[] = { IV(NAME_left, "any|function", IV_BOTH, NAME_operant, "Left-hand side"), IV(NAME_right, "any|function", IV_BOTH, NAME_operant, "Right-hand side") }; /* Send Methods */ static senddecl send_equal[] = { SM(NAME_Execute, 0, NULL, ExecuteEqual, DEFAULT, "Evaluate both sides and test on equal"), SM(NAME_initialise, 2, T_initialise, initialiseEqual, DEFAULT, "Create from left- and right-hand") }; /* Get Methods */
} /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "condition=code", "then=any|function", "else=any|function" }; /* Instance Variables */ static vardecl var_when[] = { IV(NAME_condition, "code", IV_BOTH, NAME_statement, "Condition to be tested"), IV(NAME_then, "any|function", IV_BOTH, NAME_statement, "Executed if condition is true"), IV(NAME_else, "any|function", IV_BOTH, NAME_statement, "Executed if condition is false") }; /* Send Methods */ static senddecl send_when[] = { SM(NAME_initialise, 3, T_initialise, initialiseWhen, DEFAULT, "Create from condition, when- and else"), SM(NAME_unlink, 0, NULL, succeedObject, DEFAULT, "temp; just to trap") };
} /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "name=name", "priority=0..1200", "kind={xf,yf,xfx,xfy,yfx,fy,fx}" }; /* Instance Variables */ static vardecl var_operator[] = { IV(NAME_name, "name", IV_GET, NAME_name, "Name of the operator"), IV(NAME_priority, "int", IV_GET, NAME_internal, "Priority of the operator"), IV(NAME_leftPriority, "int", IV_GET, NAME_internal, "Max priority of left-hand operant"), IV(NAME_rightPriority, "int", IV_GET, NAME_internal, "Max priority of right-hand operant") }; /* Send Methods */ static senddecl send_operator[] = { SM(NAME_initialise, 3, T_initialise, initialiseOperator, DEFAULT, "Initialise"), SM(NAME_kind, 1, "kind={xf,yf,xfx,xfy,yfx,fy,fx}", kindOperator, NAME_syntax, "Define associativity of the operator")
} /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "button=[button_name]", "modifier=[modifier]" }; /* Instance Variables */ static vardecl var_resizeOutlineGesture[] = { IV(NAME_outline, "box", IV_GET, NAME_feedback, "The outline resized"), IV(NAME_outlineGesture, "resize_gesture", IV_GET, NAME_internal, "The outline resized") }; /* Send Methods */ static senddecl send_resizeOutlineGesture[] = { SM(NAME_initialise, 2, T_initialise, initialiseResizeOutlineGesture, DEFAULT, "Create from button and modifier"), SM(NAME_drag, 1, "event", dragResizeOutlineGesture, NAME_event, "Drag outline to next position"), SM(NAME_initiate, 1, "event", initiateResizeOutlineGesture, NAME_event, "Display outline and change cursor"), SM(NAME_terminate, 1, "event", terminateResizeOutlineGesture, NAME_event, "Resize object and undisplay outline"),
succeed; } /******************************* * CLASS DECLARATION * *******************************/ /* Type declaractions */ static char *T_initialise[] = { "name=name", "context=[class|object*]" }; /* Instance Variables */ static vardecl var_behaviour[] = { IV(NAME_name, "name", IV_GET, NAME_name, "Selector of this behaviour"), IV(NAME_context, "class|object*", IV_GET, NAME_whole, "Definition context of this method") }; /* Send Methods */ static senddecl send_behaviour[] = { SM(NAME_initialise, 2, T_initialise, initialiseBehaviour, DEFAULT, "Create from <-name and <-context") }; /* Get Methods */ #define get_behaviour NULL /*
* CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_name_any_XXX[] = { "name", "any|host_data ..." }; static char *T_name_unchecked_XXX[] = { "name", "unchecked ..." }; static char *T_sendCall[] = { "name|host_data", "unchecked ..." }; /* Instance Variables */ static vardecl var_host[] = { IV(NAME_language, "{prolog,lisp,c}", IV_BOTH, NAME_host, "Host language pce is connected to"), IV(NAME_system, "name", IV_BOTH, NAME_host, "Identifier name of host language"), IV(NAME_callBack, "bool", IV_BOTH, NAME_callback, "Queue messages or invoke asynchronously"), IV(NAME_messages, "chain*", IV_GET, NAME_callback, "Message queue") }; /* Send Methods */ static senddecl send_host[] = { SM(NAME_initialise, 1, "name=name", initialiseHost, DEFAULT, "Create host from name"), SM(NAME_call, 2, T_sendCall, callHostv, NAME_callback, "Invoke a host defined send operation"),
succeed; } /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ /* Instance Variables */ static vardecl var_table_cell[] = { IV(NAME_column, "int*", IV_GET, NAME_location, "X-location in table environment"), IV(NAME_row, "int*", IV_GET, NAME_location, "Y-location in table environment"), SV(NAME_halign, "[{left,center,right,reference,stretch}]", IV_NONE|IV_STORE, halignTableCell, NAME_layout, "Horizontal alignment of <-image in cell"), SV(NAME_valign, "[{top,center,bottom,reference,stretch}]", IV_NONE|IV_STORE, valignTableCell, NAME_layout, "Vertical alignment of <-image in cell"), SV(NAME_hrubber, "rubber*", IV_GET|IV_STORE, hrubberTableCell, NAME_layout, "Horizontal stretchability"), SV(NAME_vrubber, "rubber*", IV_GET|IV_STORE, vrubberTableCell, NAME_layout, "Vertical stretchability"), SV(NAME_colSpan, "1..", IV_GET|IV_STORE, colSpanTableCell, NAME_layout, "Number of columns spanned"), SV(NAME_rowSpan, "1..", IV_GET|IV_STORE, rowSpanTableCell,
/******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_relative_toAgraphical_coordinate_system_ofADdeviceD[] = { "relative_to=graphical", "coordinate_system_of=[device]" }; static char *T_initialise[] = { "x=expression", "y=expression", "kind=[name]", "name=[name]" }; /* Instance Variables */ static vardecl var_handle[] = { IV(NAME_xPosition, "expression", IV_BOTH, NAME_location, "Expression for X in variable `w'"), IV(NAME_yPosition, "expression", IV_BOTH, NAME_location, "Expression for Y in variable `h'"), IV(NAME_kind, "name", IV_BOTH, NAME_relation, "Kind of valid connection end-point"), IV(NAME_name, "name", IV_BOTH, NAME_name, "Logical name of handle") }; /* Send Methods */ static senddecl send_handle[] = { SM(NAME_initialise, 4, T_initialise, initialiseHandle, DEFAULT, "Create from X-, Y expression, kind and name") };
* CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_create[] = { "from=graphical*", "to=graphical*" }; static char *T_fromAgraphical_toAgraphical[] = { "from=graphical", "to=graphical" }; static char *T_initialise[] = { "x1=[=]*", "y1=[=]*", "x2=[=]*", "y2=[=]*", "width=[=]*", "height=[=]*" }; /* Instance Variables */ static vardecl var_spatial[] = { IV(NAME_xFrom, "=*", IV_BOTH, NAME_position, "X of reference at `from' (XYHW -> xref)"), IV(NAME_yFrom, "=*", IV_BOTH, NAME_position, "Y of reference at `from' (XYHW -> yref)"), IV(NAME_xTo, "=*", IV_BOTH, NAME_position, "X of reference at `to' (XYHW -> xref)"), IV(NAME_yTo, "=*", IV_BOTH, NAME_position, "Y of reference at `to' (XYHW -> yref)"), IV(NAME_wTo, "=*", IV_BOTH, NAME_dimension, "Equation between `w' and `w2'"), IV(NAME_hTo, "=*", IV_BOTH, NAME_dimension, "Equation between `h' and `h2'") }; /* Send Methods */ static senddecl send_spatial[] =
{ "index=int", "value=any" }; static char *T_swap[] = { "index_1=int", "index_2=int" }; static char *T_fill[] = { "value=any", "from=[int]", "to=[int]" }; static char *T_range[] = { "from=[int]", "to=[int]" }; static char *T_sort[] = { "compare=code", "from=[int]", "to=[int]" }; static char *T_enum[] = { "code=code", "from=[int]", "to=[int]" }; /* Instance Variables */ static vardecl var_vector[] = { IV(NAME_offset, "int", IV_GET, NAME_range, "Offset relative to 1-based"), IV(NAME_size, "0..", IV_GET, NAME_range, "Number of elements"), IV(NAME_allocated, "0..", IV_GET, NAME_internal, "Allocated size of array"), IV(NAME_elements, "alien:Any *", IV_NONE, NAME_storage, "The elements themselves") }; /* Send Methods */ static senddecl send_vector[] = { SM(NAME_initialise, 1, "element=any ...", initialiseVectorv, DEFAULT, "Create vector with elements at 1, ..."), SM(NAME_unlink, 0, NULL, unlinkVector, DEFAULT, "Deallocates -elements"),
/*! For 3D and 2D. @par Revision history: - 08.06.2006, c - 02.08.2006 */ int32 orient_elements( int32 *flag, int32 flag_n_row, int32 *conn, int32 conn_n_row, int32 conn_n_col, float64 *coors, int32 coors_n_row, int32 coors_n_col, int32 *v_roots, int32 v_roots_n_row, int32 *v_vecs, int32 v_vecs_n_row, int32 v_vecs_n_col, int32 *swap_from, int32 swap_from_n_row, int32 swap_from_n_col, int32 *swap_to, int32 swap_to_n_row, int32 swap_to_n_col ) { #define IR( iel, ir ) (conn[conn_n_col*(iel)+v_roots[ir]]) #define IV( iel, ir, iv ) (conn[conn_n_col*(iel)+v_vecs[v_vecs_n_col*ir+iv]]) #define CONN( iel, ip ) (conn[conn_n_col*(iel)+ip]) #define SWF( ir, is ) (swap_from[swap_from_n_col*ir+is]) #define SWT( ir, is ) (swap_to[swap_to_n_col*ir+is]) int32 ir, iel, ii, ip0, ip1, ip2, ip3, tmp, nc; float64 v0[3], v1[3], v2[3], v3[3], cross[3], dot[1]; nc = coors_n_col; if (nc == 4) { // 3D. for (iel = 0; iel < conn_n_row; iel++) { flag[iel] = 0; for (ir = 0; ir < v_roots_n_row; ir++) { ip0 = IR( iel, ir ); ip1 = IV( iel, ir, 0 ); ip2 = IV( iel, ir, 1 ); ip3 = IV( iel, ir, 2 ); for (ii = 0; ii < 3; ii++) { v0[ii] = coors[nc*ip0+ii]; v1[ii] = coors[nc*ip1+ii] - v0[ii]; v2[ii] = coors[nc*ip2+ii] - v0[ii]; v3[ii] = coors[nc*ip3+ii] - v0[ii]; } gtr_cross_product( cross, v1, v2 ); gtr_dot_v3( dot, v3, cross ); /* output( "%d %d -> %d %d %d %d %e\n", iel, ir, ip0, ip1, ip2, ip3, */ /* dot[0] ); */ if (dot[0] < CONST_MachEps) { flag[iel]++; for (ii = 0; ii < swap_from_n_col; ii++) { SwapValues( CONN( iel, SWF( ir, ii ) ), CONN( iel, SWT( ir, ii ) ), tmp ); /* output( "%d %d\n", SWF( ir, ii ), SWT( ir, ii ) ); */ } } } /* sys_pause(); */ } } else if (nc == 3) { // 2D. for (iel = 0; iel < conn_n_row; iel++) { flag[iel] = 0; for (ir = 0; ir < v_roots_n_row; ir++) { ip0 = IR( iel, ir ); ip1 = IV( iel, ir, 0 ); ip2 = IV( iel, ir, 1 ); for (ii = 0; ii < 2; ii++) { v0[ii] = coors[nc*ip0+ii]; v1[ii] = coors[nc*ip1+ii] - v0[ii]; v2[ii] = coors[nc*ip2+ii] - v0[ii]; } v1[2] = v2[2] = 0.0; gtr_cross_product( cross, v1, v2 ); if (cross[2] < CONST_MachEps) { flag[iel]++; for (ii = 0; ii < swap_from_n_col; ii++) { SwapValues( CONN( iel, SWF( ir, ii ) ), CONN( iel, SWT( ir, ii ) ), tmp ); } } } } } return( RET_OK ); #undef IR #undef IV #undef CONN #undef SWF #undef SWT }
} /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "button=[button_name]", "modifier=[modifier]" }; /* Instance Variables */ static vardecl var_editTextGesture[] = { IV(NAME_selectionOrigin, "int", IV_BOTH, NAME_internal, "Where the selection started"), IV(NAME_maxDragDistance, "int*", IV_BOTH, NAME_cancel, "Click if dragged less"), IV(NAME_activate, "bool", IV_BOTH, NAME_internal, "@on: activate on ->terminate") }; /* Send Methods */ static senddecl send_editTextGesture[] = { SM(NAME_event, 1, "event", eventEditTextGesture, DEFAULT, "Handle typing and selection management"), SM(NAME_drag, 1, "event", dragEditTextGesture, DEFAULT, "Extend selection"), SM(NAME_initialise, 2, T_initialise, initialiseEditTextGesture, DEFAULT, "Create from button and modifier"),
} /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "receiver=object|function", "selector=name|function", "argument=any|function ..." }; /* Instance Variables */ static vardecl var_obtain[] = { IV(NAME_receiver, "object|function", IV_NONE, NAME_storage, "Receiver of the operation"), IV(NAME_selector, "name|function", IV_NONE, NAME_storage, "Name of the operation"), IV(NAME_arguments, "code_vector*", IV_NONE, NAME_storage, "Vector of arguments"), IV(NAME_Context, "any*", IV_GET, NAME_storage, "Host context information") }; /* Send Methods */ static senddecl send_obtain[] = { SM(NAME_initialise, 3, T_initialise, initialiseObtainv, DEFAULT, "Create from receiver, selector and args") };
} /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static char *T_initialise[] = { "editor=editor", "width=int", "height=int" }; /* Instance Variables */ static vardecl var_textMargin[] = { IV(NAME_editor, "editor", IV_GET, NAME_storage, "Editor I'm part of"), SV(NAME_gap, "size", IV_GET|IV_STORE, gapTextMargin, NAME_layout, "Distance between icons in X and Y"), SV(NAME_background, "[colour|pixmap]", IV_GET|IV_STORE, backgroundTextMargin, NAME_appearance, "Background colour") }; /* Send Methods */ static senddecl send_textMargin[] = { SM(NAME_initialise, 3, T_initialise, initialiseTextMargin, DEFAULT, "Create from editor, width and height"), SM(NAME_event, 1, "event", eventTextMargin, NAME_event, "Handle fragment-selection") };
assign(g, saved_selection, NIL); assign(g, scrolling, OFF); /* make sure! */ succeed; } /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ static vardecl var_browser_select_gesture[] = { IV(NAME_savedSelection, "dict_item|chain*", IV_GET, NAME_cancel, "Selection is saved on ->initiate"), IV(NAME_scrolling, "bool", IV_NONE, NAME_event, "If @on, redirect events to the scroll_bar") }; /* Send Methods */ static senddecl send_browser_select_gesture[] = { SM(NAME_event, 1, "event", eventBrowserSelectGesture, DEFAULT, "Process an event"), SM(NAME_drag, 1, "event", dragBrowserSelectGesture, DEFAULT, "Drag to next position"), SM(NAME_initialise, 0, NULL, initialiseBrowserSelectGesture, DEFAULT, "Create from button and modifier"), SM(NAME_initiate, 1, "event", initiateBrowserSelectGesture, DEFAULT, "Initiate browser_select"),
} fail; } /******************************* * CLASS DECLARATION * *******************************/ /* Type declarations */ /* Instance Variables */ vardecl var_tile_adjuster[] = { IV(NAME_client, "tile", IV_GET, NAME_tile, "Tile I adjust"), IV(NAME_orientation, "{horizontal,vertical}", IV_GET, NAME_tile, "Horizontal or vertical resize"), IV(NAME_downOffset, "int*", IV_GET, NAME_event, "Initial offset") }; /* Send Methods */ static senddecl send_tile_adjuster[] = { SM(NAME_initialise, 1, "tile", initialiseTileAdjuster, DEFAULT, "Create for tile"), SM(NAME_unlink, 0, NULL, unlinkTileAdjuster, DEFAULT, "Detach from <-client"), SM(NAME_event, 1, "event", eventTileAdjuster, NAME_event, "Handle event")
IV intobox(const IV & node) const { return IV(node[0]%nx_,node[1]%ny_,node[2]%nz_); }