From 75f50f2730eca4f98620c9cad37ee1a02aed620e Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Dec 2009 17:14:06 +0000 Subject: Update to use stdint/stdbool.h git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2386 42af7a65-404d-4744-a932-0658087f49c3 --- misc/pascal/plink/plreloc.c | 101 ++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 50 deletions(-) (limited to 'misc/pascal/plink/plreloc.c') diff --git a/misc/pascal/plink/plreloc.c b/misc/pascal/plink/plreloc.c index 32911570c..0faf0715c 100644 --- a/misc/pascal/plink/plreloc.c +++ b/misc/pascal/plink/plreloc.c @@ -2,7 +2,7 @@ * plreloc.c * Relocation management for the P-Code Linker * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ * Included Files **********************************************************************/ +#include #include #include #include @@ -56,7 +57,7 @@ #include "plreloc.h" /********************************************************************** - * Definitions + * Pre-processor Definitions **********************************************************************/ #define INITIAL_RELOC_LIST_SIZE (1024*sizeof(poffRelocation_t*)) @@ -71,8 +72,8 @@ **********************************************************************/ static poffRelocation_t *relocList = NULL; -static uint32 relocListAlloc = 0; -static uint32 nRelocs = 0; +static uint32_t relocListAlloc = 0; +static uint32_t nRelocs = 0; /********************************************************************** * Private Function Prototypes @@ -80,7 +81,7 @@ static uint32 nRelocs = 0; **********************************************************************/ static void offsetRelocation(poffRelocation_t *reloc, - uint32 pcOffset, uint32 symOffset); + uint32_t pcOffset, uint32_t symOffset); static void addRelocToList(poffRelocation_t *reloc); /********************************************************************** @@ -88,10 +89,10 @@ static void addRelocToList(poffRelocation_t *reloc); **********************************************************************/ void mergeRelocations(poffHandle_t inHandle, - uint32 pcOffset, uint32 symOffset) + uint32_t pcOffset, uint32_t symOffset) { poffRelocation_t reloc; - sint32 index; + int32_t index; do { @@ -99,18 +100,18 @@ void mergeRelocations(poffHandle_t inHandle, index = poffGetRawRelocation(inHandle, &reloc); if (index >= 0) - { - /* If the rellocation carries a "payload" that is a program - * section offset, then apply the pcOffset value to - * that "payload" - */ + { + /* If the rellocation carries a "payload" that is a program + * section offset, then apply the pcOffset value to + * that "payload" + */ - offsetRelocation(&reloc, pcOffset, symOffset); + offsetRelocation(&reloc, pcOffset, symOffset); - /* Add the relocation to the in-memory relocation list */ + /* Add the relocation to the in-memory relocation list */ - addRelocToList(&reloc); - } + addRelocToList(&reloc); + } } while (index >= 0); } @@ -119,8 +120,8 @@ void mergeRelocations(poffHandle_t inHandle, void applyRelocations(poffHandle_t outHandle) { - ubyte *progData; - uint32 progSize; + uint8_t *progData; + uint32_t progSize; int i; /* Take ownership of the program data image for a little while */ @@ -132,39 +133,39 @@ void applyRelocations(poffHandle_t outHandle) for (i = 0; i < nRelocs; i++) { poffRelocation_t *reloc = &relocList[i]; - uint32 symIndex = RLI_SYM(reloc->rl_info); - uint32 relType = RLI_TYPE(reloc->rl_info); + uint32_t symIndex = RLI_SYM(reloc->rl_info); + uint32_t relType = RLI_TYPE(reloc->rl_info); poffLibSymbol_t *sym; - uint32 progIndex; + uint32_t progIndex; switch (relType) - { - case RLT_PCAL: - /* Get the symbol referenced by the relocation. At this - * point, we assume that the system has already verified - * that there are no undefined symbols. - */ + { + case RLT_PCAL: + /* Get the symbol referenced by the relocation. At this + * point, we assume that the system has already verified + * that there are no undefined symbols. + */ - sym = getSymbolByIndex(symIndex); + sym = getSymbolByIndex(symIndex); - /* Get the index to the oPCAL instruction */ + /* Get the index to the oPCAL instruction */ - progIndex = reloc->rl_offset; + progIndex = reloc->rl_offset; - /* Sanity checking */ + /* Sanity checking */ - if (((sym->flags & STF_UNDEFINED) != 0) || - (progIndex > progSize-4)) - fatal(ePOFFCONFUSION); + if (((sym->flags & STF_UNDEFINED) != 0) || + (progIndex > progSize-4)) + fatal(ePOFFCONFUSION); - /* Perform the relocation */ + /* Perform the relocation */ - insn_FixupProcedureCall(&progData[progIndex], sym->value); - break; + insn_FixupProcedureCall(&progData[progIndex], sym->value); + break; - default: - break; - } + default: + break; + } } @@ -186,10 +187,10 @@ void releaseRelocations(void) **********************************************************************/ static void offsetRelocation(poffRelocation_t *reloc, - uint32 pcOffset, uint32 symOffset) + uint32_t pcOffset, uint32_t symOffset) { - uint32 symIndex = RLI_SYM(reloc->rl_info); - uint32 relType = RLI_TYPE(reloc->rl_info); + uint32_t symIndex = RLI_SYM(reloc->rl_info); + uint32_t relType = RLI_TYPE(reloc->rl_info); switch (relType) { @@ -217,9 +218,9 @@ static void addRelocToList(poffRelocation_t *reloc) relocList = (poffRelocation_t*)malloc(INITIAL_RELOC_LIST_SIZE); if (!relocList) - { - fatal(eNOMEMORY); - } + { + fatal(eNOMEMORY); + } relocListAlloc = INITIAL_RELOC_LIST_SIZE; } @@ -227,16 +228,16 @@ static void addRelocToList(poffRelocation_t *reloc) if ((nRelocs + 1) * sizeof(poffRelocation_t) > relocListAlloc) { - uint32 newAlloc = relocListAlloc + RELOC_LIST_INCREMENT; + uint32_t newAlloc = relocListAlloc + RELOC_LIST_INCREMENT; poffRelocation_t *tmp; /* Reallocate the file name buffer */ tmp = (poffRelocation_t*)realloc(relocList, newAlloc); if (!tmp) - { - fatal(eNOMEMORY); - } + { + fatal(eNOMEMORY); + } /* And set the new size */ -- cgit v1.2.3