Skip to content

Commit

Permalink
Make headerizer work on src/platform files
Browse files Browse the repository at this point in the history
  • Loading branch information
nwellnhof committed Jan 11, 2011
1 parent dc42962 commit 33c545b
Show file tree
Hide file tree
Showing 34 changed files with 122 additions and 8 deletions.
12 changes: 10 additions & 2 deletions src/platform/ansi/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ library functions for handling dynamic libraries.
=over 4
=cut
*/

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

/*
=item C<void * Parrot_dlopen(const char *filename, Parrot_dlopen_flags flags)>
Parrot wrapper around C<dlopen>. B<Not yet implemented.>
Expand All @@ -25,8 +35,6 @@ Parrot wrapper around C<dlopen>. B<Not yet implemented.>
*/

#include "parrot/parrot.h"

void *
Parrot_dlopen(const char *filename, SHIM(Parrot_dlopen_flags flags))
{
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ansi/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Functions for dealing with child processes and Execs. (Currently not implemented

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

/*
=item C<INTVAL Parrot_Run_OS_Command(PARROT_INTERP, STRING *command)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ansi/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Parrot process id functions.

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

/*
=item C<UINTVAL Parrot_getpid(void)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ansi/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Time-related functions.

#include <time.h>

/* HEADERIZER HFILE: none */

/*
=item C<INTVAL Parrot_intval_time(void)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/cygwin/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
_LIB_VERSION_TYPE _LIB_VERSION = _POSIX_;
#endif

/* HEADERIZER HFILE: none */

#if DOUBLE_SIZE == 2 * INT_SIZE
/*
Expand Down
2 changes: 2 additions & 0 deletions src/platform/darwin/hires_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ High-resolution timer support

#define TIME_IN_NS(n) ((n).tv_sec * 1000*1000*1000 + (n).tv_nsec)

/* HEADERIZER HFILE: none */

/*
=item C<UHUGEINTVAL Parrot_hires_get_time(void)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/darwin/sysmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Get system memory information.
#include <sys/sysctl.h>
#include <stdio.h>

/* HEADERIZER HFILE: none */

/*
=item C<size_t Parrot_sysmem_amount(PARROT_INTERP)>
Expand Down
5 changes: 5 additions & 0 deletions src/platform/generic/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Parrot functions which wrap around standard library functions for handling dynam

#define PARROT_DLOPEN_FLAGS RTLD_LAZY

/* HEADERIZER HFILE: none */

/*
=item C<void * Parrot_dlopen(const char *filename, Parrot_dlopen_flags flags)>
Expand All @@ -39,6 +41,7 @@ argument and returns a handle to it.
*/

PARROT_CAN_RETURN_NULL
void *
Parrot_dlopen(const char *filename, Parrot_dlopen_flags flags)
{
Expand All @@ -61,6 +64,7 @@ failure in use of C<Parrot_dlopen>, C<Parrot_dlclose> or C<Parrot_dlsym>.
*/

PARROT_CAN_RETURN_NULL
const char *
Parrot_dlerror(void)
{
Expand All @@ -82,6 +86,7 @@ returns address where symbol is located.
*/

PARROT_CAN_RETURN_NULL
void *
Parrot_dlsym(void *handle, const char *symbol)
{
Expand Down
2 changes: 2 additions & 0 deletions src/platform/generic/encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Platform C string encoding management

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

/*
=item C<void Parrot_init_platform_encoding(PARROT_INTERP)>
Expand Down
3 changes: 3 additions & 0 deletions src/platform/generic/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Environment manipulation stuff
#include <stdlib.h>
#include <string.h>

/* HEADERIZER HFILE: none */

/*
=item C<void Parrot_setenv(PARROT_INTERP, STRING *str_name, STRING *str_value)>
Expand Down Expand Up @@ -87,6 +89,7 @@ Get Environment vars
*/

PARROT_CANNOT_RETURN_NULL
STRING *
Parrot_getenv(PARROT_INTERP, STRING *str_name)
{
Expand Down
2 changes: 2 additions & 0 deletions src/platform/generic/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Parrot functions to run operating system commands.
#include <sys/types.h>
#include <sys/wait.h>

/* HEADERIZER HFILE: none */

/*
=item C<INTVAL Parrot_Run_OS_Command(PARROT_INTERP, STRING *command)>
Expand Down
8 changes: 6 additions & 2 deletions src/platform/generic/hires_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ High-resolution timer support
# endif
#endif

/* HEADERIZER HFILE: none */

/*
=item C<UHUGEINTVAL Parrot_hires_get_time(void)>
Expand All @@ -50,7 +52,8 @@ Return a high-resolution number representing how long Parrot has been running.
*/

UHUGEINTVAL Parrot_hires_get_time(void)
UHUGEINTVAL
Parrot_hires_get_time(void)
{
struct timespec ts;
#if _POSIX_TIMERS
Expand All @@ -75,7 +78,8 @@ Return the number of ns that each time unit from Parrot_hires_get_time represent
*/

UINTVAL Parrot_hires_get_tick_duration(void)
UINTVAL
Parrot_hires_get_tick_duration(void)
{
return (UINTVAL) 1;
}
Expand Down
3 changes: 3 additions & 0 deletions src/platform/generic/itimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ itimer stuff

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

#ifdef PARROT_HAS_SETITIMER

/*
Expand Down Expand Up @@ -96,6 +98,7 @@ The returned handle is passed to the other timer functions.
*/

PARROT_CAN_RETURN_NULL
void *
new_sys_timer_ms(void)
{
Expand Down
2 changes: 2 additions & 0 deletions src/platform/generic/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Mathematical functions.

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

/*
=item C<extern int Parrot_signbit(double x)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/generic/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Miscellaneous helper functions.

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

/*
=item C<void Parrot_platform_init_code(void)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/generic/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Parrot process id functions.
#include <sys/types.h>
#include <unistd.h>

/* HEADERIZER HFILE: none */

/*
=item C<UINTVAL Parrot_getpid(void)>
Expand Down
29 changes: 25 additions & 4 deletions src/platform/generic/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ File stat stuff
# include <sys/stat.h>
#endif

/* HEADERIZER HFILE: none */

/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */

static INTVAL stat_common(PARROT_INTERP,
ARGIN(struct stat *statbuf),
INTVAL thing,
int status)
__attribute__nonnull__(1)
__attribute__nonnull__(2);

#define ASSERT_ARGS_stat_common __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(statbuf))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */

/*
=item C<PMC * Parrot_stat_file(PARROT_INTERP, STRING *filename)>
Expand All @@ -38,10 +56,11 @@ B<Not implemented.> Returns C<NULL>.
*/

PARROT_CANNOT_RETURN_NULL
PMC *
Parrot_stat_file(SHIM_INTERP, SHIM(STRING *filename))
{
return NULL;
return PMCNULL;
}

/*
Expand All @@ -55,10 +74,11 @@ B<Not implemented.> Returns C<NULL>.
*/

PARROT_CANNOT_RETURN_NULL
PMC *
Parrot_stat_info_pmc(SHIM_INTERP, SHIM(STRING *filename), SHIM(INTVAL thing))
{
return NULL;
return PMCNULL;
}

/*
Expand Down Expand Up @@ -120,7 +140,7 @@ C<STAT_CREATETIME> and C<STAT_BACKUPTIME> are not supported and will return C<-1
*/

static INTVAL
stat_common(PARROT_INTERP, struct stat *statbuf, INTVAL thing, int status)
stat_common(PARROT_INTERP, ARGIN(struct stat *statbuf), INTVAL thing, int status)
{
INTVAL result = -1;

Expand Down Expand Up @@ -280,10 +300,11 @@ B<Not implemented.> Returns C<NULL>.
*/

PARROT_CANNOT_RETURN_NULL
STRING *
Parrot_stat_info_string(SHIM_INTERP, SHIM(STRING *filename), SHIM(INTVAL thing))
{
return NULL;
return STRINGNULL;
}

/*
Expand Down
2 changes: 2 additions & 0 deletions src/platform/generic/sysmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Get system memory information.
# include <sys/sysctl.h>
#endif

/* HEADERIZER HFILE: none */

/*
=item C<size_t Parrot_sysmem_amount(PARROT_INTERP)>
Expand Down
5 changes: 5 additions & 0 deletions src/platform/generic/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Parrot time-related functions.
#include <sys/time.h>
#include <unistd.h>

/* HEADERIZER HFILE: none */

/*
=item C<INTVAL Parrot_intval_time(void)>
Expand Down Expand Up @@ -105,6 +107,7 @@ Parrot wrapper around standard library C<gmtime_r()> function.
*/

PARROT_EXPORT
PARROT_CAN_RETURN_NULL
struct tm *
Parrot_gmtime_r(const time_t *t, struct tm *tm)
{
Expand All @@ -122,6 +125,7 @@ Parrot wrapper around standard library C<localtime_r()> function.
*/

PARROT_EXPORT
PARROT_CAN_RETURN_NULL
struct tm *
Parrot_localtime_r(const time_t *t, struct tm *tm)
{
Expand All @@ -139,6 +143,7 @@ Parrot wrapper around standard library C<asctime_r()> function.
*/

PARROT_EXPORT
PARROT_CAN_RETURN_NULL
char*
Parrot_asctime_r(const struct tm *tm, char *buffer)
{
Expand Down
2 changes: 2 additions & 0 deletions src/platform/generic/uid.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Get information about the current user

#include <unistd.h>

/* HEADERIZER HFILE: none */

/*
=item C<UINTVAL Parrot_get_user_id(void)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/linux/encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Platform C string encoding management
#include <locale.h>
#include <langinfo.h>

/* HEADERIZER HFILE: none */

/*
=item C<void Parrot_init_platform_encoding(PARROT_INTERP)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/netbsd/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Miscellaneous helper functions that are specific to NetBSD.

#include "parrot/parrot.h"

/* HEADERIZER HFILE: none */

/*
=item C<void Parrot_platform_init_code(void)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/openbsd/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;

#endif

/* HEADERIZER HFILE: none */

#if DOUBLE_SIZE == 2 * INT_SIZE
/*
Expand Down
2 changes: 2 additions & 0 deletions src/platform/solaris/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Mathematical functions.
_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
#endif

/* HEADERIZER HFILE: none */

#if DOUBLE_SIZE == 2 * INT_SIZE
/*
Expand Down
2 changes: 2 additions & 0 deletions src/platform/solaris/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Parrot time-related functions.
#include <sys/time.h>
#include <unistd.h>

/* HEADERIZER HFILE: none */

/*
=item C<INTVAL Parrot_intval_time(void)>
Expand Down
2 changes: 2 additions & 0 deletions src/platform/win32/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Functions for working with dynamic libraries under windows.

#include <windows.h>

/* HEADERIZER HFILE: none */

/*
=item C<void * Parrot_dlopen(const char *filename, Parrot_dlopen_flags flags)>
Expand Down
Loading

0 comments on commit 33c545b

Please sign in to comment.