Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

(new) Adding a `unit` ancilliary type.

(Xcode is having some trouble compiling right now, I’m not sure if it’s relevant to this changeset; compilation proceeds just fine, but I get test failures in `Thread` that I don’t get via clang on the command-line)
  • Loading branch information...
commit c77b8f856c239f48c7ac8c8f31dc456c4385e18d 1 parent a141449
@ELLIOTTCABLE authored
View
30 Paws.o.xcodeproj/project.pbxproj
@@ -20,6 +20,7 @@
5119611711D2260800DE67CF /* string.tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 511960DC11D211D100DE67CF /* string.tests.c */; };
5119611E11D22AFF00DE67CF /* Cest.c in Sources */ = {isa = PBXBuildFile; fileRef = 5119611C11D22AFF00DE67CF /* Cest.c */; };
5119612A11D22B1900DE67CF /* Threading.c in Sources */ = {isa = PBXBuildFile; fileRef = 511960BB11D211D100DE67CF /* Threading.c */; };
+ 51B5349A11D5BA0E00A0EBD8 /* Unit.tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 51B5349811D5BA0E00A0EBD8 /* Unit.tests.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -64,6 +65,9 @@
511960F511D219B500DE67CF /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; };
5119611C11D22AFF00DE67CF /* Cest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Cest.c; path = Source/Cest.c; sourceTree = "<group>"; };
5119611D11D22AFF00DE67CF /* Cest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Cest.h; path = Source/Cest.h; sourceTree = "<group>"; };
+ 51B5349611D5BA0E00A0EBD8 /* Unit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Unit.c; sourceTree = "<group>"; };
+ 51B5349711D5BA0E00A0EBD8 /* Unit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unit.h; sourceTree = "<group>"; };
+ 51B5349811D5BA0E00A0EBD8 /* Unit.tests.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Unit.tests.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -115,6 +119,7 @@
children = (
511960AE11D211D100DE67CF /* Magazine */,
511960B211D211D100DE67CF /* Threading */,
+ 51B5349511D5BA0E00A0EBD8 /* Unit */,
);
name = Ancillary;
path = Source/Paws.o/Ancillary;
@@ -231,6 +236,16 @@
path = string;
sourceTree = "<group>";
};
+ 51B5349511D5BA0E00A0EBD8 /* Unit */ = {
+ isa = PBXGroup;
+ children = (
+ 51B5349611D5BA0E00A0EBD8 /* Unit.c */,
+ 51B5349711D5BA0E00A0EBD8 /* Unit.h */,
+ 51B5349811D5BA0E00A0EBD8 /* Unit.tests.c */,
+ );
+ path = Unit;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -276,19 +291,20 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 5119610D11D225FA00DE67CF /* Magazine.tests.c in Sources */,
+ 5119611E11D22AFF00DE67CF /* Cest.c in Sources */,
+ 5119612A11D22B1900DE67CF /* Threading.c in Sources */,
5119610E11D225FB00DE67CF /* Pool.tests.c in Sources */,
5119610F11D2260000DE67CF /* Thread.tests.c in Sources */,
- 5119611011D2260100DE67CF /* Paws.tests.c in Sources */,
- 5119611111D2260200DE67CF /* execution.tests.c in Sources */,
- 5119611211D2260400DE67CF /* list.tests.c in Sources */,
+ 5119610D11D225FA00DE67CF /* Magazine.tests.c in Sources */,
+ 51B5349A11D5BA0E00A0EBD8 /* Unit.tests.c in Sources */,
5119611311D2260400DE67CF /* ll.tests.c in Sources */,
- 5119611411D2260500DE67CF /* numeric.tests.c in Sources */,
+ 5119611211D2260400DE67CF /* list.tests.c in Sources */,
5119611511D2260700DE67CF /* ast.tests.c in Sources */,
5119611611D2260700DE67CF /* routine.tests.c in Sources */,
+ 5119611111D2260200DE67CF /* execution.tests.c in Sources */,
+ 5119611411D2260500DE67CF /* numeric.tests.c in Sources */,
5119611711D2260800DE67CF /* string.tests.c in Sources */,
- 5119611E11D22AFF00DE67CF /* Cest.c in Sources */,
- 5119612A11D22B1900DE67CF /* Threading.c in Sources */,
+ 5119611011D2260100DE67CF /* Paws.tests.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
3  README.markdown
@@ -31,6 +31,7 @@ so… these:
Source/Paws.o/Ancillary/Threading/Pool/Pool.c \
Source/Paws.o/Ancillary/Threading/Thread/Thread.c \
Source/Paws.o/Ancillary/Magazine/Magazine.c \
+ Source/Paws.o/Ancillary/Unit/Unit.c \
Source/Paws.o/Types/list/ll.c \
Source/Paws.o/Types/list/list.c \
Source/Paws.o/Types/routine/ast.c \
@@ -60,6 +61,7 @@ so… these:
Source/Paws.o/Ancillary/Threading/Pool/Pool.tests.c \
Source/Paws.o/Ancillary/Threading/Thread/Thread.tests.c \
Source/Paws.o/Ancillary/Magazine/Magazine.tests.c \
+ Source/Paws.o/Ancillary/Unit/Unit.tests.c \
Source/Paws.o/Types/list/ll.tests.c \
Source/Paws.o/Types/list/list.tests.c \
Source/Paws.o/Types/routine/ast.tests.c \
@@ -76,6 +78,7 @@ so… these:
Source/Paws.o/Ancillary/Threading/Pool/Pool.tests.c \
Source/Paws.o/Ancillary/Threading/Thread/Thread.tests.c \
Source/Paws.o/Ancillary/Magazine/Magazine.tests.c \
+ Source/Paws.o/Ancillary/Unit/Unit.tests.c \
Source/Paws.o/Types/list/ll.tests.c \
Source/Paws.o/Types/list/list.tests.c \
Source/Paws.o/Types/routine/ast.tests.c \
View
39 Source/Paws.o/Ancillary/Unit/Unit.c
@@ -0,0 +1,39 @@
+#include "Unit.h"
+
+#include "Paws.o/Paws.h"
+#include <stdlib.h>
+#include <string.h>
+
+
+/* ================
+= Unit Management =
+================ */
+
+/* ### Method Declarations ### */
+
+unit Unit__allocate (void);
+
+ struct Unit // »
+ *Unit = NULL;
+void Paws__register_Unit(void) { Unit = malloc(sizeof(struct Unit));
+ Paws->Unit = Unit;
+
+ struct Unit // »
+ data = {
+ .allocate = Unit__allocate
+ };
+
+ memcpy(Unit, &data, sizeof(struct Unit));
+}
+
+
+/* ### Method Implementations ### */
+
+unit Unit__allocate(void) {
+ unit this = malloc(sizeof( struct unit ));
+
+ this->threads = Pool->allocate();
+ this->strings = Magazine->allocate(STRING);
+
+ return this;
+}
View
40 Source/Paws.o/Ancillary/Unit/Unit.h
@@ -0,0 +1,40 @@
+#define UNIT_H
+
+#if !defined(CORE_H)
+# include "Paws.o/Core.h"
+#endif
+#if !defined(TYPES_H)
+# include "Paws.o/Types/Types.h"
+#endif
+
+#if !defined(POOL_H)
+# include "Paws.o/Ancillary/Threading/Pool/Pool.h"
+#endif
+#if !defined(MAGAZINE_H)
+# include "Paws.o/Ancillary/Magazine/Magazine.h"
+#endif
+
+
+/* ### Data Types & Structures ### */
+
+ struct E(unit); /* A “unit of interpretation” */
+typedef struct E(unit)* E(unit);
+
+struct E(unit) {
+ E(pool) threads;
+ E(magazine) strings;
+};
+
+/* ### Method Declarations ### */
+
+struct E(Unit) {
+ /* `Unit` functions */
+ E(unit) (*allocate) ( void );
+
+ /* `struct unit` methods */
+};
+#if !defined(EXTERNALIZE)
+ struct E(Unit) extern *Unit;
+#endif
+
+void Paws__register_Unit ( void );
View
19 Source/Paws.o/Ancillary/Unit/Unit.tests.c
@@ -0,0 +1,19 @@
+#include "Unit.c"
+#include "Cest.h"
+
+#if !defined(STRING_H)
+# include "Paws.o/Types/routine/routine.h"
+#endif
+
+
+CEST(Unit, allocate) {
+ unit a_unit;
+
+ a_unit = Unit->allocate();
+
+ ASSERT( a_unit->threads->size == 0 );
+ ASSERT( a_unit->threads->queue == NULL );
+
+
+ SUCCEED;
+}
View
4 Source/Paws.o/Paws.c
@@ -15,8 +15,8 @@ void Paws__register_Paws(void) { Paws = malloc(sizeof(struct Paws));
struct Paws // »
data = {
.Threading = NULL,
-
.Magazine = NULL,
+ .Unit = NULL,
.List = NULL,
.Routine = NULL,
@@ -28,8 +28,8 @@ void Paws__register_Paws(void) { Paws = malloc(sizeof(struct Paws));
memcpy(Paws, &data, sizeof(struct Paws));
Paws__register_Threading();
-
Paws__register_Magazine();
+ Paws__register_Unit();
Paws__register_List();
Paws__register_Routine();
View
8 Source/Paws.o/Paws.h
@@ -8,10 +8,12 @@
# if !defined(THREADING_H)
# include "Paws.o/Ancillary/Threading/Threading.h"
# endif
-
# if !defined(MAGAZINE_H)
# include "Paws.o/Ancillary/Magazine/Magazine.h"
# endif
+# if !defined(UNIT_H)
+# include "Paws.o/Ancillary/Unit/Unit.h"
+# endif
# if !defined(LIST_H)
# include "Paws.o/Types/list/list.h"
@@ -91,8 +93,8 @@
struct Paws {
/* Namespaces */
struct E(Threading) *Threading;
-
- struct E(Magazine) *Magazine;
+ struct E(Magazine) *Magazine;
+ struct E(Unit) *Unit;
struct E(List) *List;
struct E(Routine) *Routine;
Please sign in to comment.
Something went wrong with that request. Please try again.