-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Milton Maldonado Jr
committed
Jul 17, 2019
1 parent
aea0695
commit a1eb29c
Showing
13 changed files
with
243 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Debug/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project> | ||
<configuration id="cdt.managedbuild.config.gnu.exe.debug.769796154" name="Debug"> | ||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | ||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> | ||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> | ||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> | ||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1035940305784832089" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | ||
<language-scope id="org.eclipse.cdt.core.gcc"/> | ||
<language-scope id="org.eclipse.cdt.core.g++"/> | ||
</provider> | ||
</extension> | ||
</configuration> | ||
<configuration id="cdt.managedbuild.config.gnu.exe.release.391794649" name="Release"> | ||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | ||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> | ||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> | ||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> | ||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1035940305784832089" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | ||
<language-scope id="org.eclipse.cdt.core.gcc"/> | ||
<language-scope id="org.eclipse.cdt.core.g++"/> | ||
</provider> | ||
</extension> | ||
</configuration> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* and.c | ||
* | ||
* Created on: 16 de jul de 2019 | ||
* Author: milton | ||
*/ | ||
|
||
#include <malloc.h> | ||
#include "bitand.h" | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
bitand *bitand_create(){ | ||
|
||
bitand *b = malloc(sizeof(bitand)); | ||
b->oldvalue = 2; | ||
b->out_event_handler_root = NULL; | ||
return b; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
void bitand_connect_out(bitand *a, void *obj, void (*event_handler)(void *obj, int val, int timestamp)){ | ||
|
||
new_ehandler(a->out_event_handler_root, obj, event_handler); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
int bitand_update(bitand *a){ | ||
|
||
a->value = a->ina & a->inb; | ||
|
||
if (a->oldvalue != a->value){ | ||
|
||
a->oldvalue = a->value; | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
void bitand_up(bitand *a, int val, int timestamp){ | ||
|
||
if (bitand_update(a)){ | ||
|
||
event e; | ||
e.event_handler_root = a->out_event_handler_root; | ||
e.value = a->value; | ||
e.timestamp = timestamp+1; | ||
event_insert(&e); | ||
} | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
void bitand_update_ina(bitand *a, int val, int timestamp){ | ||
|
||
if (val == a->ina) return; | ||
|
||
a->ina = val; | ||
bitand_up(a, val, timestamp); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
void bitand_update_inb(bitand *a, int val, int timestamp){ | ||
|
||
if (val == a->inb) return; | ||
|
||
a->inb = val; | ||
bitand_up(a, val, timestamp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* bitand.h | ||
* | ||
* Created on: 16 de jul de 2019 | ||
* Author: milton | ||
*/ | ||
|
||
#ifndef BITAND_H_ | ||
#define BITAND_H_ | ||
|
||
#include "update.h" | ||
|
||
typedef struct { | ||
|
||
int ina; | ||
int inb; | ||
int oldvalue; | ||
int value; | ||
ehandler *out_event_handler_root; | ||
} bitand; | ||
|
||
bitand *bitand_create(); | ||
|
||
void bitand_connect_out(bitand *a, void *obj, void (*event_handler)(void *obj, int val, int timestamp)); | ||
|
||
void bitand_update_ina(bitand *a, int val, int timestamp); | ||
void bitand_update_inb(bitand *a, int val, int timestamp); | ||
|
||
#endif /* BITAND_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.