Skip to content

Commit

Permalink
feat: 0.1.6 Fix Koliseo_Temp (#6)
Browse files Browse the repository at this point in the history
* feat: bump amboso to 1.6.1

* feat: 0.1.6 Fix Koliseo_Temp

* fix: run make on pull requests
  • Loading branch information
jgabaut committed Aug 22, 2023
1 parent 76a0ba9 commit 7d8b617
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build CI with make
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" , "devel"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down
2 changes: 1 addition & 1 deletion amboso
1 change: 1 addition & 0 deletions bin/stego.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ tests# tests folder name
0.1.2# print_kls_2file()
0.1.3# update prev_offset on kls_push()
0.1.5# add kls_log(), fixes
0.1.6# functional Koliseo_Temp
4 changes: 4 additions & 0 deletions bin/v0.1.6/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#amboso compliant version folder, will ignore everything inside BUT the gitignore, to keep the clean dir
*
!.gitignore
!static
1 change: 1 addition & 0 deletions bin/v0.1.6/static
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Define the package name and version
AC_INIT([koliseo], [0.1.5], [jgabaut@github.com])
AC_INIT([koliseo], [0.1.6], [jgabaut@github.com])

# Verify automake version and enable foreign option
AM_INIT_AUTOMAKE([foreign -Wall])
Expand All @@ -24,7 +24,7 @@ fi
# Set a default version number if not specified externally
AC_ARG_VAR([VERSION], [Version number])
if test -z "$VERSION"; then
VERSION="0.1.5"
VERSION="0.1.6"
fi

# Output variables to the config.h header
Expand Down
12 changes: 9 additions & 3 deletions src/koliseo.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ void kls_log(const char* tag, const char* msg) {
if (KOLISEO_DEBUG_FP == NULL) {
fprintf(stderr,"[KLS] kls_log(): Failed opening KOLISEO_DEBUG_FP to print logs.\n");
} else {
fprintf(KOLISEO_DEBUG_FP,"[%s] %s\n", tag, msg);
time_t now = time(0);
struct tm *mytime = localtime(&now);
char timeheader[500];
if ( strftime(timeheader, sizeof timeheader, "%X", mytime) )
{
fprintf(KOLISEO_DEBUG_FP,"[%-10.10s] [%s] [%s]\n", tag, timeheader, msg);
}
}
}
}
Expand Down Expand Up @@ -238,8 +244,8 @@ Koliseo_Temp kls_temp_start(Koliseo* kls) {
* @param kls The Koliseo at hand.
*/
void kls_temp_end(Koliseo_Temp tmp_kls) {
tmp_kls.prev_offset = tmp_kls.prev_offset;
tmp_kls.offset = tmp_kls.offset;
tmp_kls.kls->prev_offset = tmp_kls.prev_offset;
tmp_kls.kls->offset = tmp_kls.offset;
char msg[500];
sprintf(msg,"Ended Temp KLS.");
kls_log("KLS",msg);
Expand Down
6 changes: 5 additions & 1 deletion src/koliseo.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <time.h>

#define KLS_MAJOR 0 /**< Represents current major release.*/
#define KLS_MINOR 1 /**< Represents current minor release.*/
Expand All @@ -21,7 +22,7 @@ extern int KOLISEO_DEBUG;
*/
extern FILE* KOLISEO_DEBUG_FP;

static const char KOLISEO_API_VERSION_STRING[] = "0.1.5"; /**< Represents current version with MAJOR.MINOR.PATCH format.*/
static const char KOLISEO_API_VERSION_STRING[] = "0.1.6"; /**< Represents current version with MAJOR.MINOR.PATCH format.*/

const char* string_koliseo_version(void);

Expand Down Expand Up @@ -83,4 +84,7 @@ void print_dbg_kls(Koliseo* kls);
Koliseo_Temp kls_temp_start(Koliseo* kls);
void kls_temp_end(Koliseo_Temp tmp_kls);

#define KLS_PUSH_T(kls_temp, type, count) (type*)KLS_PUSH(kls_temp.kls, type, count)
#define KLS_POP_T(kls_temp, type, count) (type*)KLS_POP(kls_temp.kls, type, count)

#endif
17 changes: 16 additions & 1 deletion static/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,27 @@ int main(void) {

print_dbg_kls(kls);

Koliseo_Temp temp_kls = kls_temp_start(kls);
printf("[Started Koliseo_Temp] [pos: %li]\n",kls_get_pos(temp_kls.kls));

int minusone = -1;
int* p = &minusone;
int* p2 = &minusone;
printf("\n*p is [%i] before KLS_PUSH\n",*p);
printf("\n*p2 is [%i] before KLS_PUSH_T\n",*p2);
printf("[KLS_PUSH for a int to Koliseo] [size: %li]\n",sizeof(int));
printf("[This handles the Koliseo directly while we have an open Koliseo_Temp.]\n");
p = (int*) KLS_PUSH(kls, int, 1);
printf("[KLS_PUSH_T for a int to Koliseo_Temp] [size: %li]\n",sizeof(int));
p2 = (int*) KLS_PUSH_T(temp_kls, int, 1);
printf("[Current position in Koliseo] [pos: %li]\n",kls_get_pos(kls));
printf("[Current position in Koliseo_Temp] [pos: %li]\n",temp_kls.offset);
print_dbg_kls(kls);


*p = 1;
printf("\n*p is [%i] after KLS_PUSH\n",*p);
*p2 = 3;
printf("\n*p2 is [%i] after KLS_PUSH\n",*p2);

int* z = &minusone;
printf("\n*z is [%i] before KLS_POP\n",*z);
Expand All @@ -58,6 +68,11 @@ int main(void) {

print_dbg_kls(kls);

kls_temp_end(temp_kls);
printf("[Ended Koliseo_Temp]\n");

print_dbg_kls(kls);

printf("[Clear Koliseo]\n");
kls_clear(kls);
print_dbg_kls(kls);
Expand Down

0 comments on commit 7d8b617

Please sign in to comment.