| 4463 | // ---------------------------------------------------------------------------- |
| 4464 | |
| 4465 | BOOLEAN spmulProc( leftv result,leftv first,leftv second ) |
| 4466 | { |
| 4467 | semicState state; |
| 4468 | |
| 4469 | // ----------------- |
| 4470 | // check arguments |
| 4471 | // ----------------- |
| 4472 | |
| 4473 | lists l = (lists)first->Data( ); |
| 4474 | int k = (int)(long)second->Data( ); |
| 4475 | |
| 4476 | if( (state=list_is_spectrum( l ))!=semicOK ) |
| 4477 | { |
| 4478 | WerrorS( "first argument is not a spectrum" ); |
| 4479 | list_error( state ); |
| 4480 | } |
| 4481 | else if( k < 0 ) |
| 4482 | { |
| 4483 | WerrorS( "second argument should be positive" ); |
| 4484 | state = semicMulNegative; |
| 4485 | } |
| 4486 | else |
| 4487 | { |
| 4488 | spectrum s= spectrumFromList( l ); |
| 4489 | spectrum product( k*s ); |
| 4490 | |
| 4491 | result->rtyp = LIST_CMD; |
| 4492 | result->data = (char*)getList(product); |
| 4493 | } |
| 4494 | |
| 4495 | return (state!=semicOK); |
| 4496 | } |
| 4497 | |
| 4498 | // ---------------------------------------------------------------------------- |
| 4499 | // this procedure is called from the interpreter |
no test coverage detected