-
Notifications
You must be signed in to change notification settings - Fork 115
version.scad
File that provides functions to manage versioning.
To use, add the following lines to the beginning of your file:
include <BOSL2/std.scad>
-
Section: BOSL Library Version Functions
-
bosl_version()
– Returns the BOSL2 version as a list. -
bosl_version_num()
– Returns the BOSL2 version as a float. -
bosl_version_str()
– Returns the BOSL2 version as a string. -
bosl_required()
– Asserts that the current version of the library is at least the given version.
-
-
Section: Generic Version Functions
-
version_to_list()
– Splits a version into a list of integer version parts. -
version_to_str()
– Coerces a version into a standard version string. -
version_to_num()
– Coerces a version into a standard version float. -
version_cmp()
– Compares two versions.
-
Synopsis: Returns the BOSL2 version as a list.
Topics: Versioning
See Also: bosl_version_num(), bosl_version_str(), bosl_required()
Usage:
- ver = bosl_version();
Description:
Returns a list with three integer elements, [MAJOR,MINOR,REV],
representing the Major, Minor, and Build Revision numbers.
For example, version 2.1.43 will be returned as [2,1,43]
.
Synopsis: Returns the BOSL2 version as a float.
Topics: Versioning
See Also: bosl_version(), bosl_version_str(), bosl_required()
Usage:
- ver = bosl_version_num();
Description:
Returns a floating point number of the version, formatted like M.mmrrrr where M is the major version number,
each m is a zero-padded digit of the minor version number, and each r is a zero-padded digit of the build
revision number. For example, version 2.1.43 will be returned as 2.010043
.
Synopsis: Returns the BOSL2 version as a string.
Topics: Versioning
See Also: bosl_version(), bosl_version_num(), bosl_required()
Usage:
- ver = bosl_version_str();
Description:
Returns a string of the version, formatted like "MAJOR.MINOR.REV".
For example, version 2.1.43 will be returned as "2.1.43"
.
Synopsis: Asserts that the current version of the library is at least the given version.
Topics: Versioning
See Also: version_to_num(), version_to_str(), version_to_list(), version_cmp()
Usage:
- bosl_required(version);
Description:
Given a version as a list, number, or string, asserts that the currently installed BOSL library is at least the given version.
Arguments:
By Position | What it does |
---|---|
version |
version required |
Synopsis: Splits a version into a list of integer version parts.
Topics: Versioning
See Also: version_to_num(), version_to_str(), version_cmp(), bosl_required()
Usage:
- ver = version_to_list(x);
Description:
Given a version string, number, or list, returns the list of version integers [MAJOR,MINOR,REVISION].
Arguments:
By Position | What it does |
---|---|
x |
version to convert |
Example 1:
include <BOSL2/std.scad>
v1 = version_to_list("2.1.43"); // Returns: [2,1,43]
v2 = version_to_list(2.120234); // Returns: [2,12,234]
v3 = version_to_list([2,3,4]); // Returns: [2,3,4]
v4 = version_to_list([2,3,4,5]); // Returns: [2,3,4]
Synopsis: Coerces a version into a standard version string.
Topics: Versioning
See Also: version_to_num(), version_to_list(), version_cmp(), bosl_required()
Usage:
- str = version_to_str(version);
Description:
Takes a version string, number, or list, and returns the properly formatter version string for it.
Arguments:
By Position | What it does |
---|---|
version |
version to convert |
Example 1:
include <BOSL2/std.scad>
v1 = version_to_str([2,1,43]); // Returns: "2.1.43"
v2 = version_to_str(2.010043); // Returns: "2.1.43"
v3 = version_to_str(2.340789); // Returns: "2.34.789"
v4 = version_to_str("2.3.89"); // Returns: "2.3.89"
Synopsis: Coerces a version into a standard version float.
Topics: Versioning
See Also: version_cmp(), version_to_str(), version_to_list(), bosl_required()
Usage:
- str = version_to_num(version);
Description:
Takes a version string, number, or list, and returns the properly formatter version number for it.
Arguments:
By Position | What it does |
---|---|
version |
version to convert |
Example 1:
include <BOSL2/std.scad>
v1 = version_to_num([2,1,43]); // Returns: 2.010043
v2 = version_to_num([2,34,567]); // Returns: 2.340567
v3 = version_to_num(2.120567); // Returns: 2.120567
v4 = version_to_num("2.6.79"); // Returns: 2.060079
Synopsis: Compares two versions.
Topics: Versioning
See Also: version_to_num(), version_to_str(), version_to_list(), bosl_required()
Usage:
- cmp = version_cmp(a,b);
Description:
Given a pair of versions, in any combination of string, integer, or list, compares them, and returns the relative value of them. Returns an integer <0 if a<b. Returns 0 if a==b. Returns an integer >0 if a>b.
Example 1:
include <BOSL2/std.scad>
cmp1 = version_cmp(2.010034, "2.1.33"); // Returns: >0
cmp2 = version_cmp(2.010034, "2.1.34"); // Returns: 0
cmp3 = version_cmp(2.010034, "2.1.35"); // Returns: <0
Table of Contents
Function Index
Topics Index
Cheat Sheet
Tutorials
Basic Modeling:
- constants.scad STD
- transforms.scad STD
- attachments.scad STD
- shapes2d.scad STD
- shapes3d.scad STD
- drawing.scad STD
- masks2d.scad STD
- masks3d.scad STD
- distributors.scad STD
- color.scad STD
- partitions.scad STD
- miscellaneous.scad STD
Advanced Modeling:
- paths.scad STD
- regions.scad STD
- skin.scad STD
- vnf.scad STD
- beziers.scad
- nurbs.scad
- rounding.scad
- turtle3d.scad
Math:
- math.scad STD
- linalg.scad STD
- vectors.scad STD
- coords.scad STD
- geometry.scad STD
- trigonometry.scad STD
Data Management:
- version.scad STD
- comparisons.scad STD
- lists.scad STD
- utility.scad STD
- strings.scad STD
- structs.scad STD
- fnliterals.scad
Threaded Parts:
Parts:
- ball_bearings.scad
- cubetruss.scad
- gears.scad
- hinges.scad
- joiners.scad
- linear_bearings.scad
- modular_hose.scad
- nema_steppers.scad
- polyhedra.scad
- sliders.scad
- tripod_mounts.scad
- walls.scad
- wiring.scad
STD = Included in std.scad