/[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 3585 by schoenebeck, Fri Aug 30 17:51:24 2019 UTC revision 3678 by schoenebeck, Fri Dec 27 22:46:08 2019 UTC
# Line 376  public: Line 376  public:
376  };  };
377    
378  /**  /**
379     * Implements the built-in msb() script function.
380     */
381    class CoreVMFunction_msb FINAL : public VMIntResultFunction {
382    public:
383        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
384        bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
385        vmint minRequiredArgs() const OVERRIDE { return 1; }
386        vmint maxAllowedArgs() const OVERRIDE { return 1; }
387        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; }
388        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return false; }
389        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
390    };
391    
392    /**
393     * Implements the built-in lsb() script function.
394     */
395    class CoreVMFunction_lsb FINAL : public VMIntResultFunction {
396    public:
397        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE { return VM_NO_UNIT; }
398        bool returnsFinal(VMFnArgs* args) OVERRIDE { return false; }
399        vmint minRequiredArgs() const OVERRIDE { return 1; }
400        vmint maxAllowedArgs() const OVERRIDE { return 1; }
401        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == INT_EXPR; }
402        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return false; }
403        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
404    };
405    
406    /**
407   * Implements the built-in min() script function.   * Implements the built-in min() script function.
408   */   */
409  class CoreVMFunction_min FINAL : public VMNumberResultFunction {  class CoreVMFunction_min FINAL : public VMNumberResultFunction {
# Line 492  public: Line 520  public:
520      bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }      bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
521      bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }      bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
522      bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }      bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
523        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
524    };
525    
526    /**
527     * Implements the built-in round() script function.
528     */
529    class CoreVMFunction_round FINAL : public VMRealResultFunction {
530    public:
531        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
532        bool returnsFinal(VMFnArgs* args) OVERRIDE;
533        vmint minRequiredArgs() const OVERRIDE { return 1; }
534        vmint maxAllowedArgs() const OVERRIDE { return 1; }
535        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
536        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
537        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
538        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
539        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
540    };
541    
542    /**
543     * Implements the built-in ceil() script function.
544     */
545    class CoreVMFunction_ceil FINAL : public VMRealResultFunction {
546    public:
547        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
548        bool returnsFinal(VMFnArgs* args) OVERRIDE;
549        vmint minRequiredArgs() const OVERRIDE { return 1; }
550        vmint maxAllowedArgs() const OVERRIDE { return 1; }
551        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
552        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
553        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
554        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
555        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
556    };
557    
558    /**
559     * Implements the built-in floor() script function.
560     */
561    class CoreVMFunction_floor FINAL : public VMRealResultFunction {
562    public:
563        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
564        bool returnsFinal(VMFnArgs* args) OVERRIDE;
565        vmint minRequiredArgs() const OVERRIDE { return 1; }
566        vmint maxAllowedArgs() const OVERRIDE { return 1; }
567        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
568        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
569        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
570        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
571        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
572    };
573    
574    /**
575     * Implements the built-in sqrt() script function.
576     */
577    class CoreVMFunction_sqrt FINAL : public VMRealResultFunction {
578    public:
579        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
580        bool returnsFinal(VMFnArgs* args) OVERRIDE;
581        vmint minRequiredArgs() const OVERRIDE { return 1; }
582        vmint maxAllowedArgs() const OVERRIDE { return 1; }
583        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
584        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
585        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
586        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
587        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
588    };
589    
590    /**
591     * Implements the built-in log() script function.
592     */
593    class CoreVMFunction_log FINAL : public VMRealResultFunction {
594    public:
595        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
596        bool returnsFinal(VMFnArgs* args) OVERRIDE;
597        vmint minRequiredArgs() const OVERRIDE { return 1; }
598        vmint maxAllowedArgs() const OVERRIDE { return 1; }
599        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
600        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
601        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
602        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
603        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
604    };
605    
606    /**
607     * Implements the built-in log2() script function.
608     */
609    class CoreVMFunction_log2 FINAL : public VMRealResultFunction {
610    public:
611        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
612        bool returnsFinal(VMFnArgs* args) OVERRIDE;
613        vmint minRequiredArgs() const OVERRIDE { return 1; }
614        vmint maxAllowedArgs() const OVERRIDE { return 1; }
615        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
616        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
617        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
618        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
619        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
620    };
621    
622    /**
623     * Implements the built-in log10() script function.
624     */
625    class CoreVMFunction_log10 FINAL : public VMRealResultFunction {
626    public:
627        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
628        bool returnsFinal(VMFnArgs* args) OVERRIDE;
629        vmint minRequiredArgs() const OVERRIDE { return 1; }
630        vmint maxAllowedArgs() const OVERRIDE { return 1; }
631        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
632        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
633        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
634        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
635        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
636    };
637    
638    /**
639     * Implements the built-in exp() script function.
640     */
641    class CoreVMFunction_exp FINAL : public VMRealResultFunction {
642    public:
643        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
644        bool returnsFinal(VMFnArgs* args) OVERRIDE;
645        vmint minRequiredArgs() const OVERRIDE { return 1; }
646        vmint maxAllowedArgs() const OVERRIDE { return 1; }
647        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
648        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
649        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
650        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
651        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
652    };
653    
654    /**
655     * Implements the built-in pow() script function.
656     */
657    class CoreVMFunction_pow FINAL : public VMRealResultFunction {
658        using Super = VMRealResultFunction; // just an alias for the super class
659    public:
660        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
661        bool returnsFinal(VMFnArgs* args) OVERRIDE;
662        vmint minRequiredArgs() const OVERRIDE { return 2; }
663        vmint maxAllowedArgs() const OVERRIDE { return 2; }
664        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
665        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE;
666        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE;
667        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return iArg == 0; }
668        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
669    };
670    
671    /**
672     * Implements the built-in sin() script function.
673     */
674    class CoreVMFunction_sin FINAL : public VMRealResultFunction {
675    public:
676        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
677        bool returnsFinal(VMFnArgs* args) OVERRIDE;
678        vmint minRequiredArgs() const OVERRIDE { return 1; }
679        vmint maxAllowedArgs() const OVERRIDE { return 1; }
680        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
681        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
682        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
683        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
684        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
685    };
686    
687    /**
688     * Implements the built-in cos() script function.
689     */
690    class CoreVMFunction_cos FINAL : public VMRealResultFunction {
691    public:
692        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
693        bool returnsFinal(VMFnArgs* args) OVERRIDE;
694        vmint minRequiredArgs() const OVERRIDE { return 1; }
695        vmint maxAllowedArgs() const OVERRIDE { return 1; }
696        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
697        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
698        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
699        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
700        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
701    };
702    
703    /**
704     * Implements the built-in tan() script function.
705     */
706    class CoreVMFunction_tan FINAL : public VMRealResultFunction {
707    public:
708        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
709        bool returnsFinal(VMFnArgs* args) OVERRIDE;
710        vmint minRequiredArgs() const OVERRIDE { return 1; }
711        vmint maxAllowedArgs() const OVERRIDE { return 1; }
712        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
713        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
714        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
715        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
716        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
717    };
718    
719    /**
720     * Implements the built-in asin() script function.
721     */
722    class CoreVMFunction_asin FINAL : public VMRealResultFunction {
723    public:
724        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
725        bool returnsFinal(VMFnArgs* args) OVERRIDE;
726        vmint minRequiredArgs() const OVERRIDE { return 1; }
727        vmint maxAllowedArgs() const OVERRIDE { return 1; }
728        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
729        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
730        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
731        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
732        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
733    };
734    
735    /**
736     * Implements the built-in acos() script function.
737     */
738    class CoreVMFunction_acos FINAL : public VMRealResultFunction {
739    public:
740        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
741        bool returnsFinal(VMFnArgs* args) OVERRIDE;
742        vmint minRequiredArgs() const OVERRIDE { return 1; }
743        vmint maxAllowedArgs() const OVERRIDE { return 1; }
744        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
745        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
746        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
747        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
748        VMFnResult* exec(VMFnArgs* args) OVERRIDE;
749    };
750    
751    /**
752     * Implements the built-in atan() script function.
753     */
754    class CoreVMFunction_atan FINAL : public VMRealResultFunction {
755    public:
756        StdUnit_t returnUnitType(VMFnArgs* args) OVERRIDE;
757        bool returnsFinal(VMFnArgs* args) OVERRIDE;
758        vmint minRequiredArgs() const OVERRIDE { return 1; }
759        vmint maxAllowedArgs() const OVERRIDE { return 1; }
760        bool acceptsArgType(vmint iArg, ExprType_t type) const OVERRIDE { return type == REAL_EXPR; }
761        bool acceptsArgUnitType(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
762        bool acceptsArgUnitPrefix(vmint iArg, StdUnit_t type) const OVERRIDE { return true; }
763        bool acceptsArgFinal(vmint iArg) const OVERRIDE { return true; }
764      VMFnResult* exec(VMFnArgs* args) OVERRIDE;      VMFnResult* exec(VMFnArgs* args) OVERRIDE;
765  };  };
766    

Legend:
Removed from v.3585  
changed lines
  Added in v.3678

  ViewVC Help
Powered by ViewVC