Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clm
Commits
32a6323d
Commit
32a6323d
authored
Oct 13, 2003
by
Ronny Wichers Schreur
🏘
Browse files
initial import (htoclean 1.2)
parent
0e499baf
Changes
65
Expand all
Hide whitespace changes
Inline
Side-by-side
htoclean/CallingCFromClean.html
0 → 100644
View file @
32a6323d
This diff is collapsed.
Click to expand it.
htoclean/Clean.h
0 → 100644
View file @
32a6323d
#define Clean(a)
typedef
struct
clean_string
*
CleanString
;
/* a string in Clean is:
struct clean_string {
int clean_string_length;
char clean_string_characters[clean_string_length];
};
The string does not end with a '\0' !
*/
/* CleanStringLength(clean_string) returns the length of the clean_string in characters */
#define CleanStringLength(clean_string) (*(unsigned int *)(clean_string))
/* CleanStringCharacters(clean_string) returns a pointer to the characters of the clean_string */
#define CleanStringCharacters(clean_string) ((char*)(1+(unsigned int *)(clean_string)))
/* CleanStringSizeInts(string_length) return size of *CleanString in integers */
#define CleanStringSizeInts(string_length) (1+(((unsigned int)(string_length)+3)>>2))
/* CleanStringVariable(clean_string,string_length) defines variable clean_string with length string_length,
before using the clean_string variable, cast to CleanString, except for the macros above */
#define CleanStringVariable(clean_string,string_length) unsigned int clean_string[CleanStringSizeInts(string_length)]
/* CleanStringSizeBytes(string_length) return size of *CleanString in bytes */
#define CleanStringSizeBytes(string_length) (4+(((unsigned int)(string_length)+3) & -4))
typedef
int
*
CleanIntArray
;
/* CleanIntArraySize(clean_array) returns the size (number of elements) of the clean_int_array */
#define CleanIntArraySize(clean_int_array) (((unsigned int *)(clean_int_array))[-2])
typedef
double
*
CleanRealArray
;
/* CleanRealArraySize(clean_real_array) returns the size (number of elements) of the clean_real_array */
#define CleanRealArraySize(clean_real_array) (((unsigned int *)(clean_real_array))[-2])
typedef
unsigned
char
*
CleanCharArray
;
/* CleanCharArraySize(clean_char_array) returns the size (number of elements) of the clean_char_array */
#define CleanCharArraySize(clean_char_array) (((unsigned int *)(clean_char_array))[-1])
htoclean/Examples/Clean.h
0 → 100644
View file @
32a6323d
#define Clean(a)
typedef
struct
clean_string
*
CleanString
;
/* a string in Clean is:
struct clean_string {
int clean_string_length;
char clean_string_characters[clean_string_length];
};
The string does not end with a '\0' !
*/
/* CleanStringLength(clean_string) returns the length of the clean_string in characters */
#define CleanStringLength(clean_string) (*(unsigned int *)(clean_string))
/* CleanStringCharacters(clean_string) returns a pointer to the characters of the clean_string */
#define CleanStringCharacters(clean_string) ((char*)(1+(unsigned int *)(clean_string)))
/* CleanStringSizeInts(string_length) return size of *CleanString in integers */
#define CleanStringSizeInts(string_length) (1+(((unsigned int)(string_length)+3)>>2))
/* CleanStringVariable(clean_string,string_length) defines variable clean_string with length string_length,
before using the clean_string variable, cast to CleanString, except for the macros above */
#define CleanStringVariable(clean_string,string_length) unsigned int clean_string[CleanStringSizeInts(string_length)]
/* CleanStringSizeBytes(string_length) return size of *CleanString in bytes */
#define CleanStringSizeBytes(string_length) (4+(((unsigned int)(string_length)+3) & -4))
typedef
int
*
CleanIntArray
;
/* CleanIntArraySize(clean_array) returns the size (number of elements) of the clean_int_array */
#define CleanIntArraySize(clean_int_array) (((unsigned int *)(clean_int_array))[-2])
typedef
double
*
CleanRealArray
;
/* CleanRealArraySize(clean_real_array) returns the size (number of elements) of the clean_real_array */
#define CleanRealArraySize(clean_real_array) (((unsigned int *)(clean_real_array))[-2])
typedef
unsigned
char
*
CleanCharArray
;
/* CleanCharArraySize(clean_char_array) returns the size (number of elements) of the clean_char_array */
#define CleanCharArraySize(clean_char_array) (((unsigned int *)(clean_char_array))[-1])
htoclean/Examples/example_array1.dcl
0 → 100644
View file @
32a6323d
definition
module
example_array1
;
//1.3
from
StdString
import
String
;
//3.1
sum_int_array
::
!{#
Int
}
->
Int
;
// int sum_int_array (CleanIntArray a);
sum_real_array
::
!{#
Real
}
->
Real
;
// double sum_real_array (CleanRealArray a);
first_different_char_index
::
!{#
Char
}
!{#
Char
}
->
Int
;
// int first_different_char_index (CleanCharArray a1,CleanCharArray a2);
htoclean/Examples/example_array1.h
0 → 100644
View file @
32a6323d
int
sum_int_array
(
CleanIntArray
a
);
Clean
(
sum_int_array
::
{
#
Int
}
->
Int
)
double
sum_real_array
(
CleanRealArray
a
);
Clean
(
sum_real_array
::
{
#
Real
}
->
Real
)
int
first_different_char_index
(
CleanCharArray
a1
,
CleanCharArray
a2
);
Clean
(
f
::
{
#
Char
}
{
#
Char
}
->
Int
)
htoclean/Examples/example_array1.icl
0 → 100644
View file @
32a6323d
implementation
module
example_array1
;
//1.3
from
StdString
import
String
;
//3.1
sum_int_array
::
!{#
Int
}
->
Int
;
sum_int_array
a0
=
code {
ccall
sum_int_array
"A:I"
}
// int sum_int_array (CleanIntArray a);
sum_real_array
::
!{#
Real
}
->
Real
;
sum_real_array
a0
=
code {
ccall
sum_real_array
"A:R"
}
// double sum_real_array (CleanRealArray a);
first_different_char_index
::
!{#
Char
}
!{#
Char
}
->
Int
;
first_different_char_index
a0
a1
=
code {
ccall
first_different_char_index
"ss:I"
}
// int first_different_char_index (CleanCharArray a1,CleanCharArray a2);
htoclean/Examples/example_array1_c.c
0 → 100644
View file @
32a6323d
#include "Clean.h"
int
sum_int_array
(
CleanIntArray
a
)
{
int
sum
,
s
,
i
;
s
=
CleanIntArraySize
(
a
);
sum
=
0
;
for
(
i
=
0
;
i
<
s
;
++
i
)
sum
+=
a
[
i
];
return
sum
;
}
double
sum_real_array
(
CleanRealArray
a
)
{
double
sum
;
int
s
,
i
;
s
=
CleanRealArraySize
(
a
);
sum
=
0
;
for
(
i
=
0
;
i
<
s
;
++
i
)
sum
+=
a
[
i
];
return
sum
;
}
int
first_different_char_index
(
CleanCharArray
a1
,
CleanCharArray
a2
)
{
int
s1
,
s2
,
i
;
s1
=
CleanCharArraySize
(
a1
);
s2
=
CleanCharArraySize
(
a2
);
for
(
i
=
0
;
i
<
s1
&&
i
<
s2
;
++
i
)
if
(
a1
[
i
]
!=
a2
[
i
])
return
i
;
if
(
s1
!=
s2
)
return
i
;
else
return
-
1
;
}
int
_fltused
;
htoclean/Examples/example_array1_main.icl
0 → 100644
View file @
32a6323d
module
example_array1_main
;
import
StdEnv
;
import
example_array1
;
Start
=
(
sum_int_array
{
1
,
2
,
3
},
sum_real_array
{
1.5
,
2.6
,
3.7
},
first_different_char_index
"abcdef"
"abzdef"
)
htoclean/Examples/example_array1_main.prj
0 → 100644
View file @
32a6323d
Version: 1.3
Global
Built: True
CodeGen
CheckStacks: False
CheckIndexes: False
KeepABC: False
TargetProcessor: CurrentProcessor
Application
HeapSize: 409600
StackSize: 102400
ExtraMemory: 0
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time601: False
Time: False
Output
Output: ShowConstructors
Font: Courier
FontSize: 8
WriteStdErr: False
Project
Verbose: False
Link
DefaultSystemObjects: True
DefaultLibraries: True
ExtraObjects
Path: {Project}\example_array1_c.obj
Paths
Path: {Project}
MainModule
Name: example_array1_main
Dir: {Project}
IclOpen: True
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: False
ReuseUniqueNodes: False
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 537
SizeY: 187
IclOpen: True
LastModified: Yes 2001 11 16 12 31 10
Dependencies
Module: StdArray
Module: StdBool
Module: StdChar
Module: StdCharList
Module: StdClass
Module: StdEnum
Module: StdEnv
Module: StdFile
Module: StdFunc
Module: StdInt
Module: StdList
Module: StdMisc
Module: StdOrdList
Module: StdOverloaded
Module: StdReal
Module: StdString
Module: StdTuple
Module: _SystemArray
Module: _SystemEnum
Module: example_array1
Module: example_array1_main
OtherModules
Module
Name: StdEnv
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: False
ReuseUniqueNodes: True
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
IclOpen: False
LastModified: Yes 2001 10 24 11 41 20
Dependencies
Module: StdArray
Module: StdBool
Module: StdChar
Module: StdCharList
Module: StdClass
Module: StdEnum
Module: StdEnv
Module: StdFile
Module: StdFunc
Module: StdInt
Module: StdList
Module: StdMisc
Module: StdOrdList
Module: StdOverloaded
Module: StdReal
Module: StdString
Module: StdTuple
Module: _SystemArray
Module: _SystemEnum
Module
Name: StdBool
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: False
ReuseUniqueNodes: False
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
IclOpen: False
LastModified: Yes 2001 10 24 11 41 20
Dependencies
Module: StdBool
Module: StdOverloaded
Module
Name: StdOverloaded
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: True
ReuseUniqueNodes: True
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
IclOpen: False
LastModified: Yes 2001 10 24 11 41 20
Dependencies
Module: StdOverloaded
Module
Name: StdInt
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: False
ReuseUniqueNodes: False
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
IclOpen: False
LastModified: Yes 2001 10 24 11 41 20
Dependencies
Module: StdArray
Module: StdBool
Module: StdChar
Module: StdClass
Module: StdInt
Module: StdMisc
Module: StdOverloaded
Module: _SystemArray
Module
Name: StdReal
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: False
ReuseUniqueNodes: False
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
IclOpen: False
LastModified: Yes 2001 10 24 11 41 20
Dependencies
Module: StdArray
Module: StdBool
Module: StdChar
Module: StdClass
Module: StdInt
Module: StdOverloaded
Module: StdReal
Module: _SystemArray
Module
Name: StdChar
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: False
ReuseUniqueNodes: False
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
IclOpen: False
LastModified: Yes 2001 10 24 11 41 20
Dependencies
Module: StdBool
Module: StdChar
Module: StdClass
Module: StdInt
Module: StdOverloaded
Module
Name: StdArray
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True
Warnings: False
Verbose: False
ReadableABC: True
ReuseUniqueNodes: True
Dcl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
DclOpen: False
Icl
Editor
TabSize: 4
Font: Courier
FontSize: 10
AutoIndent: True
WindowPosition
X: 61
Y: 14
SizeX: 1044
SizeY: 686
IclOpen: False
LastModified: Yes 2001 10 24 11 41 20
Dependencies
Module: StdArray
Module: _SystemArray
Module
Name: _SystemArray
Dir: {Application}\StdEnv
IclOpen: False
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: AllTypes
ListAttributes: True