/[svn]/linuxsampler/trunk/src/scriptvm/CoreVMFunctions.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/CoreVMFunctions.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3589 by schoenebeck, Fri Aug 30 17:51:24 2019 UTC revision 3590 by schoenebeck, Mon Sep 2 09:03:31 2019 UTC
# Line 495  public: Line 495  public:
495      VMFnResult* exec(VMFnArgs* args) OVERRIDE;      VMFnResult* exec(VMFnArgs* args) OVERRIDE;
496  };  };
497    
498    /**
499     * Implements the built-in round() script function.
500     */
501    class CoreVMFunction_round FINAL : public VMRealResultFunction {
502    public:
503        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
504        bool returnsFinal(VMFnArgs* args) OVERRIDE;
505        vmint minRequiredArgs() const OVERRIDE { return 1; }
506        vmint maxAllowedArgs() const OVERRIDE { return 1; }
507        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
508        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
509        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
510        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
511        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
512    };
513    
514    /**
515     * Implements the built-in ceil() script function.
516     */
517    class CoreVMFunction_ceil FINAL : public VMRealResultFunction {
518    public:
519        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
520        bool returnsFinal(VMFnArgs* args) OVERRIDE;
521        vmint minRequiredArgs() const OVERRIDE { return 1; }
522        vmint maxAllowedArgs() const OVERRIDE { return 1; }
523        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
524        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
525        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
526        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
527        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
528    };
529    
530    /**
531     * Implements the built-in floor() script function.
532     */
533    class CoreVMFunction_floor FINAL : public VMRealResultFunction {
534    public:
535        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
536        bool returnsFinal(VMFnArgs* args) OVERRIDE;
537        vmint minRequiredArgs() const OVERRIDE { return 1; }
538        vmint maxAllowedArgs() const OVERRIDE { return 1; }
539        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
540        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
541        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
542        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
543        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
544    };
545    
546    /**
547     * Implements the built-in sqrt() script function.
548     */
549    class CoreVMFunction_sqrt FINAL : public VMRealResultFunction {
550    public:
551        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
552        bool returnsFinal(VMFnArgs* args) OVERRIDE;
553        vmint minRequiredArgs() const OVERRIDE { return 1; }
554        vmint maxAllowedArgs() const OVERRIDE { return 1; }
555        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
556        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
557        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
558        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
559        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
560    };
561    
562    /**
563     * Implements the built-in log() script function.
564     */
565    class CoreVMFunction_log FINAL : public VMRealResultFunction {
566    public:
567        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
568        bool returnsFinal(VMFnArgs* args) OVERRIDE;
569        vmint minRequiredArgs() const OVERRIDE { return 1; }
570        vmint maxAllowedArgs() const OVERRIDE { return 1; }
571        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
572        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
573        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
574        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
575        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
576    };
577    
578    /**
579     * Implements the built-in log2() script function.
580     */
581    class CoreVMFunction_log2 FINAL : public VMRealResultFunction {
582    public:
583        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
584        bool returnsFinal(VMFnArgs* args) OVERRIDE;
585        vmint minRequiredArgs() const OVERRIDE { return 1; }
586        vmint maxAllowedArgs() const OVERRIDE { return 1; }
587        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
588        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
589        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
590        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
591        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
592    };
593    
594    /**
595     * Implements the built-in log10() script function.
596     */
597    class CoreVMFunction_log10 FINAL : public VMRealResultFunction {
598    public:
599        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
600        bool returnsFinal(VMFnArgs* args) OVERRIDE;
601        vmint minRequiredArgs() const OVERRIDE { return 1; }
602        vmint maxAllowedArgs() const OVERRIDE { return 1; }
603        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
604        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
605        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
606        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
607        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
608    };
609    
610    /**
611     * Implements the built-in exp() script function.
612     */
613    class CoreVMFunction_exp FINAL : public VMRealResultFunction {
614    public:
615        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
616        bool returnsFinal(VMFnArgs* args) OVERRIDE;
617        vmint minRequiredArgs() const OVERRIDE { return 1; }
618        vmint maxAllowedArgs() const OVERRIDE { return 1; }
619        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
620        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
621        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
622        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
623        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
624    };
625    
626    /**
627     * Implements the built-in pow() script function.
628     */
629    class CoreVMFunction_pow FINAL : public VMRealResultFunction {
630        using Super = VMRealResultFunction; // just an alias for the super class
631    public:
632        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
633        bool returnsFinal(VMFnArgs* args) OVERRIDE;
634        vmint minRequiredArgs() const OVERRIDE { return 2; }
635        vmint maxAllowedArgs() const OVERRIDE { return 2; }
636        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
637        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
638        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
639        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return iArg == 0; }
640        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
641    };
642    
643    /**
644     * Implements the built-in sin() script function.
645     */
646    class CoreVMFunction_sin FINAL : public VMRealResultFunction {
647    public:
648        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
649        bool returnsFinal(VMFnArgs* args) OVERRIDE;
650        vmint minRequiredArgs() const OVERRIDE { return 1; }
651        vmint maxAllowedArgs() const OVERRIDE { return 1; }
652        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
653        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
654        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
655        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
656        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
657    };
658    
659    /**
660     * Implements the built-in cos() script function.
661     */
662    class CoreVMFunction_cos FINAL : public VMRealResultFunction {
663    public:
664        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
665        bool returnsFinal(VMFnArgs* args) OVERRIDE;
666        vmint minRequiredArgs() const OVERRIDE { return 1; }
667        vmint maxAllowedArgs() const OVERRIDE { return 1; }
668        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
669        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
670        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
671        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
672        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
673    };
674    
675    /**
676     * Implements the built-in tan() script function.
677     */
678    class CoreVMFunction_tan FINAL : public VMRealResultFunction {
679    public:
680        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
681        bool returnsFinal(VMFnArgs* args) OVERRIDE;
682        vmint minRequiredArgs() const OVERRIDE { return 1; }
683        vmint maxAllowedArgs() const OVERRIDE { return 1; }
684        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
685        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
686        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
687        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
688        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
689    };
690    
691    /**
692     * Implements the built-in asin() script function.
693     */
694    class CoreVMFunction_asin FINAL : public VMRealResultFunction {
695    public:
696        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
697        bool returnsFinal(VMFnArgs* args) OVERRIDE;
698        vmint minRequiredArgs() const OVERRIDE { return 1; }
699        vmint maxAllowedArgs() const OVERRIDE { return 1; }
700        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
701        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
702        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
703        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
704        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
705    };
706    
707    /**
708     * Implements the built-in acos() script function.
709     */
710    class CoreVMFunction_acos FINAL : public VMRealResultFunction {
711    public:
712        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
713        bool returnsFinal(VMFnArgs* args) OVERRIDE;
714        vmint minRequiredArgs() const OVERRIDE { return 1; }
715        vmint maxAllowedArgs() const OVERRIDE { return 1; }
716        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
717        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
718        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
719        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
720        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
721    };
722    
723    /**
724     * Implements the built-in atan() script function.
725     */
726    class CoreVMFunction_atan FINAL : public VMRealResultFunction {
727    public:
728        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
729        bool returnsFinal(VMFnArgs* args) OVERRIDE;
730        vmint minRequiredArgs() const OVERRIDE { return 1; }
731        vmint maxAllowedArgs() const OVERRIDE { return 1; }
732        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
733        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
734        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
735        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
736        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
737    };
738    
739  } // namespace LinuxSampler  } // namespace LinuxSampler
740    
741  #endif // LS_COREVMFUNCTIONS_H  #endif // LS_COREVMFUNCTIONS_H

Legend:
Removed from v.3589  
changed lines
  Added in v.3590

  ViewVC Help
Powered by ViewVC