GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - shellfire-dev/byte: byte functions module for shellfire

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
COPYRIGHT
COPYRIGHT
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
byte.functions
byte.functions
 
 

Repository files navigation

byte: functions module for shellfire

This module provides an immature framework for manipulating byte and bit values from shell script.

Compatibility

  • Tag release_2015.0117.1750-1 is compatible with shellfire release release_2015.0117.1750-1.

Overview

For example, to test if a bit is set:-

# tests if bit 1 (zero based) of value 3 is set
if byte_isBitSet 3 1; then
	echo "Success"
fi

Importing

To import this module, add a git submodule to your repository. From the root of your git repository in the terminal, type:-

mkdir -p lib/shellfire
cd lib/shellfire
git submodule add "https://github.com/shellfire-dev/byte.git"
cd -
git submodule init --update

You may need to change the url https://github.com/shellfire-dev/byte.git" above if using a fork.

You will also need to add paths - include the module paths.d.

Namespace byte

To use in code

If calling from another shellfire module, add to your shell code the line

core_usesIn byte

in the global scope (ie outside of any functions). A good convention is to put it above any function that depends on functions in this module. If using it directly in a program, put this line inside the _program() function:-

_program()
{
	core_usesIn byte
	…
}

Functions


byte_isBitSet()

Parameter Value Optional
value Byte value as a number. Signed or unsigned irrelevant. No
bitIndex Zero based bit between 7 and 0 inclusive (not validated) No

Return code is zero if set, non-zero it otherwise.


byte_printBinary()

Parameter Value Optional
value Byte value as a number. Signed or unsigned irrelevant. No

Writes eight binary digits of 0 or 1 to standard out.


byte_setBit()

Parameter Value Optional
value Byte value as a number. Signed or unsigned irrelevant. No
bitIndex Zero based bit between 7 and 0 inclusive (not validated) No

Takes the value value, sets the bit bitIndex to 1 and writes the resultant value to standard out.

About

byte functions module for shellfire

Resources

Readme
License
Activity
Custom properties

Stars

3 stars

Watchers

1 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.