#include <stdio.h>
#include <stdlib.h>
#include "bytes.h"
Go to the source code of this file.
Functions | |
byte | get_byte (bytes *crusty, int index) |
void | set_byte (bytes *moe, int index, const byte beer) |
bytes * | new_bytes (int length) |
bytes * | byte2bytes (byte *moe, int l) |
void | free_bytes (bytes *maggie) |
int | num_bytes (bytes *bart) |
void | print_bytes (bytes *burns) |
bytes * | cat_bytes (bytes *homer, bytes *marge) |
void | copy_bytes (bytes *lisa, bytes *nelson) |
bytes * | duplicate_bytes (bytes *smithers) |
|
Definition at line 57 of file bytes.c. References bytes::block, and bytes::length. 00062 { 00063 bytes *wade; 00064 00065 wade = malloc(sizeof(bytes)); 00066 wade->block = moe; 00067 wade->length = l; 00068 return wade; 00069 }
|
|
Definition at line 134 of file bytes.c. References bytes::block, byte, error(), and bytes::length. 00139 { 00140 byte *newblock; 00141 int i,j; 00142 00143 if ((homer != NULL) && (marge != NULL)) { 00144 00145 newblock = malloc(homer->length + marge->length); 00146 if (newblock != NULL) { 00147 j=0; 00148 for (i=0; i<homer->length; i++) 00149 newblock[j++]=homer->block[i]; 00150 for (i=0; i<marge->length; i++) 00151 newblock[j++]=marge->block[i]; 00152 if (homer->block != NULL) 00153 free(homer->block); 00154 homer->block=newblock; 00155 homer->length=j; 00156 } 00157 else 00158 error("cat_bytes","can't allocate new block"); 00159 } 00160 return (homer); 00161 }
|
|
Definition at line 163 of file bytes.c. References bytes::block, and bytes::length. Referenced by duplicate_bytes(). 00169 { 00170 int i; 00171 00172 if (lisa->length == nelson->length) { 00173 for (i=0; i<lisa->length; i++) { 00174 lisa->block[i] = nelson->block[i]; 00175 } 00176 } 00177 }
|
|
Definition at line 180 of file bytes.c. References copy_bytes(), new_bytes(), and num_bytes(). 00186 { 00187 bytes *sideshow_bob; 00188 00189 sideshow_bob = new_bytes(num_bytes(smithers)); 00190 if (sideshow_bob != NULL) { 00191 copy_bytes(sideshow_bob, smithers); 00192 } 00193 return (sideshow_bob); 00194 }
|
|
Definition at line 72 of file bytes.c. References bytes::block. Referenced by multiplex(). 00077 { 00078 if (maggie != NULL) { 00079 if (maggie->block != NULL) 00080 free(maggie->block); 00081 free(maggie); 00082 } 00083 }
|
|
Definition at line 13 of file bytes.c. References bytes::block, byte, and bytes::length. Referenced by al_send_request(), multiplex(), swapbits(), and swapbytes(). 00017 { 00018 if ((crusty != NULL) && (index < crusty->length)) 00019 return (crusty->block[index]); 00020 else 00021 return (-1); 00022 }
|
|
Definition at line 33 of file bytes.c. References bytes::block, byte, error(), and bytes::length. Referenced by code_audio(), duplicate_bytes(), and get_al_pdu(). 00035 : 00036 * 00037 * bytes *book = new_bytes(50); 00038 * 00039 */ 00040 { 00041 bytes *homer; 00042 00043 homer = malloc(sizeof(bytes)); 00044 if (homer != NULL) { 00045 homer->block = malloc(length * sizeof(byte)); 00046 if (homer->block == NULL) { 00047 free(homer); 00048 homer = NULL; 00049 } 00050 } 00051 if (homer==NULL) 00052 error("new_bytes","can't allocate memory for new bytes structure"); 00053 homer->length = length; 00054 return homer; 00055 }
|
|
Definition at line 85 of file bytes.c. References bytes::length. Referenced by al_send_request(), duplicate_bytes(), interleave_header(), and place_rcpc(). 00090 { 00091 if (bart != NULL) 00092 return (bart->length); 00093 else 00094 return (-1); 00095 }
|
|
Definition at line 98 of file bytes.c. References bytes::block, and bytes::length. 00100 : 00101 * 00102 * xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx : cccccccccccccccc 00103 * 00104 */ 00105 { 00106 int i, j; 00107 00108 if (burns != NULL) { 00109 printf("%d bytes:\n", burns->length); 00110 00111 for (i=0; i < ((burns->length + 15) / 16); i++) { 00112 for (j=0; j < 16; j++) { 00113 if ((i*16+j) < burns->length) 00114 printf("%X ", burns->block[i*16+j]); 00115 else 00116 printf(" "); 00117 } 00118 printf(": "); 00119 for (j=0; j < 16; j++) { 00120 if ((i*16+j) < burns->length) { 00121 if (burns->block[i*16+j] >= 32) 00122 putchar(burns->block[i*16+j]); 00123 else 00124 putchar('.'); 00125 } else { 00126 putchar(' '); 00127 } 00128 } 00129 printf("\n"); 00130 } 00131 } 00132 }
|
|
Definition at line 24 of file bytes.c. References bytes::block, and bytes::length. Referenced by get_al_pdu(), swapbits(), and swapbytes().
|