User Tools

Site Tools


Table of Contents

Dana's standard library, or central source tree, contains a wide range of generally useful components to support data manipulation, networking, and interaction with the operating system to perform actions such as reading the current date and time.

You can use this functionality be declaring that your component requires a given interface from the standard library, such as requires net.TCPSocket.

You can browse the functionality of the standard library by examining the “resources” folder of Dana; this contains all of the interfaces supported by the standard library and each interface is commented to describe its general purpose.

Here we describe the main folders of the standard library and what they are for.


This folder contains interfaces to help control the composition of a piece of software. The main interface here is the loader, allowing you to load components into memory.


This folder contains interfaces to manipulate integers and strings, and contains a sub-folder adt for abstract data types to create lists and hash maps of data.

The StringUtil interface would for example be used like this:

component provides App requires data.StringUtil stringUtil{
   int App:main(AppParam params[])
      String s = stingUtil.subString(params[0].string, 1, 5)
      return 0

This gets a sub string (characters 1-6) of the first command line parameter.


This folder contains abstract data types like lists, queues and hash tables. As an example, you can create and iterate over a list as follows:

data Person{
   copy char name[]
component provides App requires data.adt.List, io.Output out{
   int App:main(AppParam params[])
      List l = new List()
      l.add(new Person("Sam"))
      l.add(new Person("Alex"))
      l.add(new Person("Joe"))
      for (Person p = l.getFirst(); p != null; p = l.getNext())
      return 0


This folder contains interfaces for input and output operations, including terminal / command-line operations (io.Input and io.Output) and file / file system operations.

As an example, you can write to a file as follows:

component provides App requires io.File {
   int App:main(AppParam params[])
      File fd = new File("test.txt", File.FILE_ACCESS_WRITE)
      fd.write("some text")
      return 0


This folder contains interfaces to do computer networking, including both TCP and UDP. See the components/examples folder for various example programs that use networking support.


This folder contains interfaces to get the current system date and time and also to pause a thread for a given time interval (using the Timer interface).


This folder contains interfaces to create graphical user interfaces; this functionality currently works only on Microsoft Windows platforms.

standard-library.txt · Last modified: 2015/12/17 04:12 by barryfp

Page Tools