...
 
Commits (444)
Clean System Files
_Tests
_Tests.*
*.abc
*.bc
*.o
*-sapl
*-www
*-data
*.tcl
*.prj
*.prp
* Time Profile.pcl
*.exe
a.out
* Time Profile.pcl
_Tests
_Tests.*
test-nightly:
image: camilstaps/clean:nightly
linux-x64:
before_script:
- install_clean.sh bundle-complete
- apt-get update -qq
- apt-get install -y -qq build-essential git coreutils libsnappy-dev
- apt-get install -y -qq build-essential git coreutils libmariadb-dev librdkafka-dev libsnappy-dev libsqlite3-dev
- make -C src/cdeps install
image: "camilstaps/clean:nightly"
- git clone https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler tests/common/compiler
- make -C tests/common/compiler/main/Unix
- make -j -C tests/common/compiler/backendC/CleanCompilerSources -f Makefile.linux64
- mkdir -p tests/common/compiler/backend/Clean\ System\ Files
- ln -fs ../../backendC/CleanCompilerSources/backend.a tests/common/compiler/backend/Clean\ System\ Files/backend_library
script:
- make -C tests/linux64 run
- stdbuf -o0 -e0 testproperties -IL Dynamics -d src/libraries/OS-Independent -P Quiet -r -T 'Tests 100000' -C -h -C 100m
- make -C tests imports_common imports_posix imports_linux imports_linux_64 imports_x86
- COCLPATH=./compiler make -C tests/common run
- cleantest -r testproperties --options '-IL;Dynamics;-I;src/libraries/OS-Posix;-I;src/libraries/OS-Linux;-d;src/libraries/OS-Independent;-P;OutputTestEvents;-T;Tests 100000;-T;MaxStringLength 500;-T;Bent;-C;-h;-C;100m;-r' --junit junit.xml
- make -C src/examples
artifacts:
when: always
paths:
- junit.xml
reports:
junit: junit.xml
test-stable:
linux-x86:
before_script:
- CLEAN_PLATFORM=x86 install_clean.sh bundle-complete
- apt-get update -qq
- apt-get install -y -qq patch build-essential coreutils libsnappy-dev
- make -C src/cdeps install
- install_clean.sh "stable lib-dynamics lib-tcpip lib-graphcopy lib-graphcopy test"
image: "camilstaps/clean:nightly"
- apt-get install -y -qq build-essential git coreutils libmariadb-dev:i386 librdkafka-dev:i386 libsnappy-dev:i386 libsqlite3-dev:i386
- CFLAGS=-m32 make -C src/cdeps install
- git clone https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler tests/common/compiler
- make -C tests/common/compiler/main/Unix
- make -j -C tests/common/compiler/backendC/CleanCompilerSources
- mkdir -p tests/common/compiler/backend/Clean\ System\ Files
- ln -fs ../../backendC/CleanCompilerSources/backend.a tests/common/compiler/backend/Clean\ System\ Files/backend_library
script:
- COLLECTIONS='OS-Posix OS-Linux OS-Linux-32 Platform-x86' make -C tests imports_common imports_posix imports_linux imports_linux_32 imports_x86
- COCLPATH=./compiler make -C tests/common run
- cleantest -r testproperties --options '-IL;Dynamics;-I;src/libraries/OS-Posix;-I;src/libraries/OS-Linux;-d;src/libraries/OS-Independent;-P;OutputTestEvents;-T;Tests 100000;-T;MaxStringLength 500;-T;Bent;-C;-h;-C;100m;-r' --junit junit.xml
- COLLECTIONS='OS-Posix OS-Linux OS-Linux-32 Platform-x86' make -C src/examples
artifacts:
when: always
paths:
- junit.xml
reports:
junit: junit.xml
windows-x64:
tags:
- windows
- x64
before_script:
- wget -UseBasicParsing -o clean.zip https://ftp.cs.ru.nl/Clean/builds/windows-x64/clean-bundle-complete-windows-x64-latest.zip
- 7z x clean.zip
- $Env:CLEAN_HOME = "$Pwd\clean-bundle-complete"
- $Env:Path += ";${Env:CLEAN_HOME}"
- make -C src\cdeps install
- $Env:WINDOWS=1
- $Env:COLLECTIONS='OS-Windows OS-Windows-64 Platform-x86'
script:
- make -C tests/linux64 run
allow_failure: true
- make -C tests imports_common imports_windows imports_windows_64 imports_x86
- cleantest.exe -r "${Env:CLEAN_HOME}\testproperties.exe" --options '-IL;Dynamics;-I;src/libraries/OS-Windows;-d;src/libraries/OS-Independent;-P;OutputTestEvents;-T;Tests 100000;-T;MaxStringLength 500;-T;Bent;-C;-h;-C;100m;-r' --junit junit.xml
- make -C src/examples
artifacts:
when: always
paths:
- junit.xml
reports:
junit: junit.xml
......@@ -23,8 +23,7 @@ map :: (a -> b) [a] -> [b]
For short documentation items, doclines, starting with `//*` can be used. When
documenting a constructor, or record field, they should be placed *after* the
item they document. Doclines are only supported for constructors and record
fields. For example:
item they document. For example:
```clean
/**
......@@ -37,6 +36,23 @@ fields. For example:
}
```
To add several lines of documentation to a constructor or record field, several
doclines can be used:
```clean
:: MyType
= MyConstructor args // ...
//* This constructor may require some more explanation,
//* which is added on several lines.
```
Doclines can also be added *above* a function, type, or class definition:
```clean
//* The identity function.
id :: .a -> .a
```
## Markup in documentation
Some simple Markdown-inspired markup is allowed in documentation:
......@@ -67,7 +83,7 @@ information.
| Constructor | ![][y] | | | | | | |
| Function | ![][y] | ![][y] | ![][y] | | | | ![][y] | ![][y]
| Generic | ![][y] | ![][y] | ![][y] | | ![][y] | | |
| Instance | | | | | | | |
| Instance | ![][y] | | | | | | |
| Macro | ![][y] | ![][y] | ![][y] | ![][y]<sup>2</sup> | | | |
| Module | ![][y] | | | | | | |
| Record field | ![][y] | | | | | | |
......@@ -96,6 +112,18 @@ With [clean-test-properties][]' `testproperties` tool, [Gast][] test programs
can be generated with properties from docblocks. For this, several additional
fields can be used, which are further documented by [clean-test-properties][].
Our [standards](STANDARDS.md) require the use of tabs for indentation and spaces
for outlining. Because with properties code is included in documentation blocks,
using tabs for indentation would lead to tabs after spaces. To avoid this, we
use four spaces in this context instead. For example:
```clean
/**
* @property correctness: A.xs :: Set a:
* minList (toList xs) == findMin xs
*/
```
[clean-test-properties]: https://gitlab.science.ru.nl/clean-and-itasks/clean-test-properties
[Gast]: https://gitlab.science.ru.nl/clean-and-itasks/gast
......
......@@ -3,8 +3,6 @@
The following guidelines should be adhered to when developing libraries for the
Clean Platform library collection.
## What is the purpose of Clean Platform
Clean Platform was created to have a central place where commonly used
functionality was stored so that people didn't have to look for it. All the
functionality should be available on all platforms. This means that
......@@ -12,14 +10,22 @@ functionality only working on Windows has no place here. It is allowed to
simulate functionality across systems. Examples of this is the System.Process
module that offers the same API across platforms.
## Type names
## Contents
- [Code style](#code-style)
- [Instances and derivations](#instances-and-derivations)
- [OS/Architecture-specific implementations](#os-architecture-specific-implementations)
## Code style
### Type names
The names of types should be clear and informative, and should always start
with a capital. If the name of a type consists of multiple words, each new
word should start with a capital. Whenever the name is an abbreviation the
abbreviation should be written using only capitals (e.g. GUI,SQL,HTTP).
## Function names
### Function names
Function names should be written in lowerCamelCase. By starting types and
constructors with a capital and functions without one, the difference between
......@@ -27,7 +33,7 @@ a constructor and a function is immediately clear for the reader of a program.
Generic function names should normally start with `g`, and the next character
should be a capital.
## Module names
### Module names
For modules, the same guidelines apply as for naming types. Names should be
informative and preferably short.
......@@ -41,7 +47,7 @@ informative and preferably short.
could also be reasonably implemented differently, it should be prefixed with
`Gen`.
## Argument order
### Argument order
While there are no hard demands on the order in which you specify the arguments
of functions, there are two rules which make your functions easier to use and
......@@ -52,7 +58,7 @@ somewhat more clear:
- Arguments which are used as "options" in some way should be at the beginning
of the arguments. This makes it easy to pass in options by currying.
## Comments
### Comments
A concise description of the purpose of a function and the meaning of its
arguments and result should be present in the .dcl file for all exported
......@@ -76,12 +82,12 @@ order. Some other special fields are used, like `@gin-icon`, but one should be
reluctant with inventing new field names. If there is a general use case,
adding it can be discussed.
## Layout
### Layout
- Tabs should be used for indentation. Spaces for alignment.
- The `where` keyword should be at the same level as the parent code block.
## Exporting functions and types
### Exporting functions and types
Definition modules (.dcl) must be very specific about the modules they import
because everything imported in a definition module is exported as well,
......@@ -92,37 +98,96 @@ collisions, adhere to the following conventions:
signatures by using the `from ... import ...` notation.
- Only ever import an entire module with the `import ...` notation if you
really truly want to re-export the entire module.
really want to re-export the entire module.
Implementation modules may import anything they like.
## Implementing class instances and generic derives
## Instances and derivations
Clean Platform should, where applicable, provide instances for the types it provides for classes defined in StdEnv, Gast, and Platform itself.
The applicable instances for the _general_ classes should be exported in the module of the type and not of the class.
This means that for example the `Functor` instance of `Maybe` should be defined in `Data.Maybe` and not in `Data.Functor`.
This means that for example the `Functor` instance of `Either` should be defined in `Data.Either` and not in `Data.Functor`.
For _specific_ classes the instances for types should be exported in submodules.
For example, `JSONEncode` for `Map` should be exported in `Data.Map.GenJSON` and not in `Data.Map` nor in `Text.GenJSON`.
This rule also holds for types that have multiple valid instances such as the `Monoid` for `Int`.
_general_ classes are:
*General* classes are:
- `Functor` from `Data.Functor`
- `Monoid, Semigroup` from `Data.Monoid`
- `Monad` from `Control.Monad` and applicable monads from `Control.Monad.*`
- `Applicative, Alternative` from `Control.Applicative`
- `gEq{|*|}` from `Data.GenEq`
- `gDefault{|*|}` from `Data.GenDefault`
- `GenFDomain` from `Data.GenFDomain`
- Everything from `StdOverloaded`
*Specific* classes are for example:
- `JSONEncode, JSONDecode` from `Text.JSON`
- `ggen, genShow` from `Gast`
## OS/Architecture-specific implementations
Some low-level functionality requires different implementations for different
platforms. This is for example the case for modules dealing with external
processes or network interfaces. In src/libraries there are different
directories for different platforms and architectures, besides the
OS-Independent directory which is for code that works anywhere.
When implementing functionality that is OS or Architecture-specific it should
be implemented for all platforms. A common interface should be defined in
OS-Independent. This allows programmers to rely on the common interface and
trust that their application is cross-platform. A separate, platform-dependent
module prefixed with an underscore should be added to the other OS- or
Platform- directories.
In general, such a setup should follow the following rules:
- [ ] `Functor` from `Data.Functor`
- [ ] `Monoid, Semigroup` from `Data.Monoid`
- [ ] `Monad` from `Control.Monad` and applicable monads from `Control.Monad.*`
- [ ] `Applicative, Alternative` from `Control.Applicative`
- [ ] `gEq{|*|}` from `Data.GenEq`
- [ ] `gDefault{|*|}` from `Data.GenDefault`
- [ ] `GenFDomain` from `Data.GenFDomain`
- [ ] everything from `StdOverloaded`
- [ ] ...
- Programs importing modules from OS-Independent must compile on any platform.
- The use of 'internal' functions should be discouraged by prefixing their name
with an underscore.
- Differences between platforms must be documented.
_specific_ classes are for example:
An example is the text-to-speech module System.TTS. OS-Independent contains
System.TTS with the following definitions:
- [ ] `JSONEncode, JSONDecode` from `Text.JSON`
- [ ] ...
```clean
from System._TTS import :: Voice
tts :: !String !*World -> *World
ttsWithVoice :: !Voice !String !*World -> *World
```
System.\_TTS is defined in OS-Linux, OS-Mac, and OS-Windows, with something
like:
```clean
:: Voice = Male1 // | ...
_tts :: !(?Voice) !String !*World -> *World
```
The platform-specific function starts with an underscore, discouraging its use.
Furthermore, it is documented that `Voice` has different constructors on each
operating system.
When specific implementation details are not available everywhere, this should
be clearly documented in the OS-Independent definition module. For example, on
Windows no different TTS voices are available; `Voice` contains only one
constructor and `tts` and `ttsWithVoice` are essentially equivalent. This way,
the general System.TTS API can still be used on Windows even though this aspect
cannot be used.
On the other hand, in the OS-Mac version of System.\_TTS, additional functions
are defined:
```clean
ttsToFile :: !String !String !*World -> *World
ttsWithVoiceToFile :: !Voice !String !String !*World -> *World
```
## OS/Architecture specific functionality
When implementing functionality that is OS or Architecture specific it is preferred to implement it for all platforms.
This means that it is preferred to define a common interface to offer the same functionality on all platforms.
However, this is not always possible (e.g. PseudoTTY support is not available on windows) and therefore this is not mandatory.
Since these have not been implemented for other platforms, they cannot be added
to System.TTS (it would be confusing if they would be a no-op). Therefore they
are in the platform-specific System.\_TTS, with a clear warning that it is not
cross-platform.
CC=gcc
OBJS:=systemsignal.o
OBJS:=bsearch.o systemsignal.o systemprocess.o WCsubst.o
all: $(OBJS)
install: $(OBJS)
mkdir -p ../libraries/OS-Independent/Clean\ System\ Files/
cp -v $(OBJS) ../libraries/OS-Independent/Clean\ System\ Files/
#ifdef _WIN32
# include <windows.h>
/* These functions are defined in the Clean run-time system; they print to
* stderr. */
extern void ew_print_string (char*);
extern void ew_print_int (int);
static HANDLE StdErr=NULL;
DWORD WINAPI readFileInSeparateThread (HANDLE *args)
{
HANDLE file=args[0];
/* NB: without this WriteFile, readPipeBlockingMulti may hang... */
if (StdErr==NULL)
StdErr=GetStdHandle (STD_ERROR_HANDLE);
WriteFile (StdErr,"",0,NULL,NULL);
if (!ReadFile (file,NULL,0,NULL,NULL)){
int err=GetLastError();
if (err!=109){
ew_print_string ("ReadFile failed (");
ew_print_int (GetLastError());
ew_print_string (")\n");
return 1;
}
}
return 0;
}
#endif
......@@ -41,3 +41,8 @@ void signal_poll(long handler, long *ok, long *state, long *handlerr)
*ok = 0;
}
}
int signal_ignore(long signum)
{
return signal(signum, SIG_IGN) == SIG_ERR;
}
IPLookup
MapDemo
PM
ProcessDemo
SQLDbDemo
WebDemo
client
server
module IPLookup
import StdEnv
import IP, Maybe, CommandLine
import Network.IP, System.CommandLine
Start :: *World -> (String, *World)
Start world
# (cmd,world) = getCommandLine world
| length cmd <> 2 = ("Usage: " +++ cmd !! 0 +++ " hostname",world)
= case lookupIPAddress (cmd !! 1) world of
(Just addr, world) = (toString addr, world)
(Nothing, world) = ("Could not lookup IP address", world)
(?Just addr, world) = (toString addr, world)
(?None, world) = ("Could not lookup IP address", world)
Version: 1.4
Global
Built: True
Target: Clean Platform
Exec: {Project}\IPLookup.exe
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 4194304
StackSize: 102400
ExtraMemory: 81920
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Output
Output: ShowConstructors
Font: Courier
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Precompile:
Postlink:
MainModule
Name: IPLookup
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
Icl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
IclOpen: False
OtherModules
Module
Name: StdFunc
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: _SystemEnum
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdEnum
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdMisc
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdList
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdReal
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdChar
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: Pointer
Dir: {Application}\CleanPlatform\src\libraries\System
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdInt
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdBool
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdClass
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: _SystemArray
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False
IclOpen: False
Module
Name: StdArray
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdOverloaded
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: StdString
Dir: {Application}\Libraries\StdEnv
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: IP
Dir: {Application}\CleanPlatform\src\libraries\Network\OS-Windows
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Dcl
WindowPosition
X: 10
Y: 10
SizeX: 800
SizeY: 640
DclOpen: False
Icl
WindowPosition
X: 237
Y: 84
SizeX: 1198
SizeY: 640
IclOpen: False
NeededLibraries
Library: wsock32.txt
Module
Name: Maybe
Dir: {Application}\CleanPlatform\src\libraries\Data
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: Text
Dir: {Application}\CleanPlatform\src\libraries
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Static
Mods
Path: {Project}\IPLookup.icl
Path: {Application}\Libraries\StdEnv\StdFunc.icl
Path: {Application}\Libraries\StdEnv\_SystemEnum.icl
Path: {Application}\Libraries\StdEnv\StdEnum.icl
Path: {Application}\Libraries\StdEnv\StdMisc.icl
Path: {Application}\Libraries\StdEnv\StdList.icl
Path: {Application}\Libraries\StdEnv\StdReal.icl
Path: {Application}\Libraries\StdEnv\StdChar.icl
Path: {Application}\CleanPlatform\src\libraries\System\Pointer.icl
Path: {Application}\Libraries\StdEnv\StdInt.icl
Path: {Application}\Libraries\StdEnv\StdBool.icl
Path: {Application}\Libraries\StdEnv\StdClass.icl
Path: {Application}\Libraries\StdEnv\_SystemArray.icl
Path: {Application}\Libraries\StdEnv\StdArray.icl
Path: {Application}\Libraries\StdEnv\StdOverloaded.icl
Path: {Application}\Libraries\StdEnv\StdString.icl
Path: {Application}\CleanPlatform\src\libraries\Network\OS-Windows\IP.icl
Path: {Application}\CleanPlatform\src\libraries\Data\Maybe.icl
Path: {Application}\CleanPlatform\src\libraries\Text.icl
Objs
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup0.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup1.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup2.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_system.o
Path: {Project}\Clean System Files\IPLookup.o
Path: {Application}\CleanPlatform\src\libraries\Network\OS-Windows\Clean System Files\IP.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdString.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdOverloaded.o
Path: {Application}\CleanPlatform\src\libraries\Data\Clean System Files\Maybe.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdBool.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdFunc.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdClass.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdInt.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdMisc.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdChar.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdArray.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_SystemArray.o
Path: {Application}\CleanPlatform\src\libraries\Clean System Files\Text.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdList.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdReal.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdEnum.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_SystemEnum.o
Path: {Application}\CleanPlatform\src\libraries\System\Clean System Files\Pointer.o
Dlib
Path: {Application}\Libraries\StdEnv\Clean System Files\kernel_library
Path: {Application}\Libraries\StdEnv\Clean System Files\user_library
Path: {Application}\Libraries\StdEnv\Clean System Files\gdi_library
Path: {Application}\Libraries\StdEnv\Clean System Files\comdlg_library
Path: {Application}\CleanPlatform\src\libraries\Network\OS-Windows\Clean System Files\wsock32.txt
Pths
Path: {Project}
Path: {Application}\Libraries\StdEnv
Path: {Application}\CleanPlatform\src\libraries
Path: {Application}\CleanPlatform\src\libraries\Data
Path: {Application}\CleanPlatform\src\libraries\Database
Path: {Application}\CleanPlatform\src\libraries\Gui
Path: {Application}\CleanPlatform\src\libraries\Internet
Path: {Application}\CleanPlatform\src\libraries\Internet\Http
Path: {Application}\CleanPlatform\src\libraries\Math
Path: {Application}\CleanPlatform\src\libraries\Network
Path: {Application}\CleanPlatform\src\libraries\Network\OS-Windows
Path: {Application}\CleanPlatform\src\libraries\System
Path: {Application}\CleanPlatform\src\libraries\System\OS-Windows
Path: {Application}\CleanPlatform\src\libraries\Test
Path: {Application}\CleanPlatform\src\libraries\Text
Path: {Application}\CleanPlatform\src\libraries\Text\Encodings
AppP: C:\Documents and Settings\Bas Lijnse\Desktop\Clean
PrjP: C:\Documents and Settings\Bas Lijnse\Desktop\Clean\CleanPlatform\src\examples
all:
clm -I "../env/all-libraries" -nt MapDemo -o MapDemo
clm -I "../env/all-libraries" -nt -nr WebDemo -o WebDemo
clm -I "../env/all-libraries" -nt IPLookup -o IPLookup
ifeq ($(WINDOWS),1)
override CLMFLAGS+=-dynamics
else
override CLMFLAGS+=-dynamics -aC,-h,100m
endif
PROJECTDIRS:=socket WebPM
EXAMPLES:=IPLookup MapDemo ProcessDemo SQLDbDemo WebDemo client server PM
VPATH:=$(PROJECTDIRS)
CLM?=clm
COLLECTIONS?=Platform-x86 OS-Posix OS-Linux OS-Linux-64
CLMLIBS:=\
-I ../libraries/OS-Independent\
-I ../libraries/OS-Independent/Deprecated/ArgEnv\
-I ../libraries/OS-Independent/Deprecated/Generics\
-I ../libraries/OS-Independent/Deprecated/MersenneTwister\
-I ../libraries/OS-Independent/Deprecated/StdLib\
$(addprefix -I ../libraries/,$(COLLECTIONS))\
$(addprefix -I ,$(PROJECTDIRS))\
-IL TCPIP\
-IL Dynamics
all: $(EXAMPLES)
.FORCE:
%: %.icl .FORCE
$(CLM) $(CLMFLAGS) $(CLMLIBS) $@ -o $@
module MapDemo
import StdEnv, Map
import StdEnv
import qualified Data.Map
Start = fromList [(i,i) \\ i <- [1..25]]
Start = 'Data.Map'.fromList [(i,i) \\ i <- [1..25]]
......@@ -2,10 +2,11 @@ module ProcessDemo
import StdEnv
import Environment
import FilePath
import File
import Process
import Data.Maybe
import System.Environment
import System.FilePath
import System.File
import System.Process
Start world
# (mTemp, world) = getEnvironmentVariable "TEMP" world
......@@ -17,7 +18,7 @@ Start world
# (mWindir, world) = getEnvironmentVariable "windir" world
| isNothing mWindir = ("windir environment variable not found", world)
# editor = fromJust mWindir </> "notepad.exe"
# (res, world) = callProcess editor [textfile] Nothing world
# (res, world) = callProcess editor [textfile] ?None world
| isError res = ("Failed to run process: " +++ snd (fromError res), world)
# (res, world) = readFile textfile world
......
......@@ -8,13 +8,15 @@ module SQLDbDemo
import StdEnv,Text
import SQL //Import SQL database API
import MySQL //Import MySQL databaseimplementation
import Database.SQL //Import SQL database API
import Database.SQL.MySQL //Import MySQL databaseimplementation
MYSQL_HOST :== "localhost"
MYSQL_USER :== "root"
MYSQL_PASS :== "test"
MYSQL_NAME :== "addressbook"
dbinfo =
{ database = "addressbook"
, host = ?Just "localhost"
, username = ?Just "root"
, password = ?Just "test"
}
:: Contact =
{ name :: String
......@@ -42,7 +44,7 @@ openMySQLDb :: !*World -> (!*MySQLCursor, !*MySQLConnection, !*MySQLContext, !*W
openMySQLDb world
# (err,mbContext,world) = openContext world
| isJust err = abort (toString (fromJust err))
# (err,mbConn,context) = openConnection MYSQL_HOST MYSQL_USER MYSQL_PASS MYSQL_NAME (fromJust mbContext)
# (err,mbConn,context) = openConnection dbinfo (fromJust mbContext)
| isJust err = abort (toString (fromJust err))
# (err,mbCursor,connection) = openCursor (fromJust mbConn)
| isJust err = abort (toString (fromJust err))
......@@ -72,7 +74,7 @@ insertContact contact cursor
| isJust error = abort (toString (fromJust error))
= cursor
where
values = [SQLVVarchar contact.name, SQLVVarchar contact.phoneNr]
values = [SQLVVarchar contact.Contact.name, SQLVVarchar contact.phoneNr]
//Selecting data
printAllContacts :: !*cursor !*World -> (*cursor,*World) | SQLCursor cursor
......
......@@ -3,9 +3,10 @@ module WebDemo
* Simple CGI application built solely on clean-platform libs
*/
import StdEnv
import HTML //Text.Html
import HTTP //Internet.Http
import CGI //Internet.Http.Cgi
import Text.HTML
import Internet.HTTP
import Internet.HTTP.CGI
import qualified Data.Map
page = HtmlTag [] [head,body]
head = HeadTag [] [TitleTag [] [Text "Hello World!"]]
......@@ -13,11 +14,11 @@ body = BodyTag [] [H1Tag [] [Text "Hello World!"]]
helloPage :: !HTTPRequest !*World -> (!HTTPResponse,!*World)
helloPage req world
= ({newHTTPResponse & rsp_data = toString (page (name req))},world)
= ({okResponse & rsp_data = toString (page (name req))},world)
where
name req = case get "name" req.arg_get of
Nothing = "world"
(Just n) = n
name req = case 'Data.Map'.get "name" req.arg_get of
?None = "world"
(?Just n) = n
page name = HtmlTag [] [head name,body name]
head name = HeadTag [] [TitleTag [] [Text "Hello ", Text name]]
body name = BodyTag [] [H1Tag [] [Text "Hello ", Text name]]
......
module PM
import StdEnv, StdGeneric
import Text, Map, UrlEncoding, HTTP, CGI
import SQL, MySQL, RelationalMapping
import PMHtml, PMForms
import Data.Maybe
import Database.SQL
import Database.SQL.MySQL
import Database.SQL.RelationalMapping
import Internet.HTTP
import Internet.HTTP.CGI
import Text
import