github.com/unidoc/unidoc@v2.2.0+incompatible/pdf/ps/handy.go (about)

     1  /*
     2   * This file is subject to the terms and conditions defined in
     3   * file 'LICENSE.md', which is part of this source code package.
     4   */
     5  
     6  package ps
     7  
     8  func MakeReal(val float64) PSObject {
     9  	obj := PSReal{}
    10  	obj.Val = val
    11  	return &obj
    12  }
    13  
    14  func MakeInteger(val int) PSObject {
    15  	obj := PSInteger{}
    16  	obj.Val = val
    17  	return &obj
    18  }
    19  
    20  func MakeBool(val bool) *PSBoolean {
    21  	obj := PSBoolean{}
    22  	obj.Val = val
    23  	return &obj
    24  }
    25  
    26  func MakeOperand(val string) *PSOperand {
    27  	obj := PSOperand(val)
    28  	return &obj
    29  }
    30  
    31  func abs(x int) int {
    32  	if x < 0 {
    33  		return -x
    34  	}
    35  	return x
    36  }