Has anyone else had problems with framework assistant when importing from a direct location ?
I have this piece of code that gets imported from a folder, rather then the modules folder. (this way i dont have to keep compiling it via bmk).
Now when i import this into my code file, i get this error along with a host of others
At no point in my program do i use any audio functions.
Anyone ?
Strict Import BRL.Bank Import brl.stream 'this file contains anything that is global to any file 'constants Private Const _eol:String = "~r~n" Public 'this type simply extends the built in bank class, agiving helper functions used by the tcp network layer Type Tbuffer Field _buffer:Byte Ptr Field _size:Int Field _filled:Int = 0 Field _blocksize:Int = 1024 Function Create:tbuffer(nsize:Int) Assert nsize >= 0 Else "Illegal buffer size" Local temp_buffer:tbuffer = New tbuffer temp_buffer._buffer = MemAlloc(nsize) temp_buffer._size = nsize temp_buffer._filled = 0 Return temp_buffer End Function Method Delete() If _size>=0 MemFree _buffer End Method Method Buffer:Byte Ptr() 'this function returns the pointer to the buffer Return _buffer End Method Method SetBlockSize(nsize:Int) 'sets a new blocksize for the buffer _blocksize = nsize End Method Method GetBlockSize:Int() 'gets teh current block size fo teh buffer Return _blocksize End Method Method GetCapacity:Int() 'gets the current max size of the buffer Return _size End Method Method TrimLeft:Int(ncount:Int) Assert ncount <= _filled Else "Buffer out of bounds" 'trims X amount of data from left of the buffer Local temp_i:Int 'shift the data left For temp_i = ncount Until _filled _buffer[temp_i - ncount] = _buffer[temp_i] Next 'decreased filled count _filled :- ncount End Method Method TrimRight:Int(ncount:Int) Assert ncount <= _filled Else "Buffer out of bounds" 'trims X amount of data from right of the buffer _filled :- ncount End Method Method Cut:tbuffer(nstart:Int=0,nend:Int=0) Assert nend >= 0 And nend <= _filled And nstart >= 0 And nstart <= _filled Else "Buffer out of bounds" 'this function will cut a chunk of data and return it as a new buffer object Local temp_count:Int = 0 Local temp_i:Int = 0 'check for cut until end If nend = 0 nend = _filled 'check for end before start If nend < nstart temp_i = nend nend = nstart nstart = temp_i End If 'calculate section details temp_count = nend - nstart Local temp_buffer:tbuffer = CreateBuffer(temp_count) Local temp_shift:Int = _filled - nstart - temp_count 'check for 0 sized cut If temp_count = 0 Return temp_buffer 'check for cut until end If temp_count = -1 temp_count = _filled - nstart 'read out data from buffer into new buffer For temp_i = 0 Until temp_count temp_buffer._buffer[temp_i] = _buffer[nstart + temp_i] Next temp_buffer._filled = temp_count 'shift data right closing the gap in old buffer For temp_i = 0 Until temp_shift _buffer[nstart + temp_i] = _buffer[nstart + temp_count + temp_i] Next 'shrink the filled size to reflect this _filled :- temp_count Return temp_buffer End Method Method CutAsString:String(nstart:Int=0,nend:Int=0) Assert nend >= 0 And nend <= _filled And nstart >= 0 And nstart <= _filled Else "Buffer out of bounds" 'this function will cut a chunk of data and return it as a string Local temp_count:Int = 0 Local temp_i:Int = 0 'check for cut until end If nend = 0 nend = _filled 'check for end before start If nend < nstart temp_i = nend nend = nstart nstart = temp_i End If 'calculate section details temp_count = nend - nstart Local temp_buffer:String = "" Local temp_shift:Int = _filled - nstart - temp_count 'check for 0 sized cut If temp_count = 0 Return temp_buffer 'check for cut until end If temp_count = -1 temp_count = _filled - nstart 'read out data from buffer into new buffer For temp_i = 0 Until temp_count temp_buffer:+ Chr(_buffer[nstart + temp_i]) Next 'shift data right closing the gap in old buffer For temp_i = 0 Until temp_shift _buffer[nstart + temp_i] = _buffer[nstart + temp_count + temp_i] Next 'shrink the filled size to reflect this _filled :- temp_count Return temp_buffer End Method Method Copy:tbuffer(nstart:Int=0,ncount:Int=0) Assert nstart + ncount <= _filled Else "Buffer out of bounds" 'this function will copy a chunk of data and return it as a new buffer object Local temp_buffer:tbuffer = CreateBuffer(ncount) Local temp_i:Int = 0 'check for copy entire contents of buffer If nstart = 0 And ncount = 0 nstart = 0 ncount = _filled End If 'check for 0 sized cut If ncount = 0 Return temp_buffer 'check for copy until end If ncount = -1 ncount = _size - nstart 'read out data from buffer into new buffer For temp_i = 0 Until ncount temp_buffer._buffer[temp_i] = _buffer[nstart + temp_i] Next temp_buffer._filled = ncount Return temp_buffer End Method Method CopyAsString:String(nstart:Int,ncount:Int) 'this function will copy a chunk of data and return it as a new buffer object Local temp_buffer:String = "" Local temp_i:Int = 0 'check for 0 sized cut If ncount = 0 Return temp_buffer 'check for buffer too small If nstart + ncount > _filled ncount :- _filled - nstart 'check for copy until end If ncount = -1 ncount = _size - nstart 'read out data from buffer into new buffer For temp_i = 0 Until ncount temp_buffer :+ Chr(_buffer[nstart + temp_i]) Next Return temp_buffer End Method Method SetCapacity(nsize:Int,nuseblocks:Int = False) 'setcapacity the amount into blocks If nuseblocks nsize = CalculateBlockSize(nsize) 'setcapacity the buffer If nsize <> _size Local temp_buffer:Byte Ptr Local temp_bytes:Int 'create a tempory buffer and copy the old information into it temp_buffer = MemAlloc(nsize) 'calculate number of bytes to copy If _filled > nsize temp_bytes = nsize Else temp_bytes = _filled End If 'copy bytes into new buffer MemCopy(temp_buffer,_buffer,temp_bytes) 'clear the old buffer MemFree(_buffer) 'save the new buffer _buffer = temp_buffer _size = nsize EndIf 'correct buffer if filled data exceeded it If _filled > _size _filled = _size End Method Method GetSize:Int() 'gets the current size of the buffer Return _filled End Method Method CalculateBlockSize(nsize:Int) 'takes a size value and calculates what to setcapacity that in blocks Local temp_i:Int = nsize Mod _blocksize Return (((nsize - temp_i) / _blocksize) + (temp_i > 0)) * _blocksize End Method Method Clear() 'clears the buffer _filled = 0 End Method Method PeekByte:Int(noffset:Int) Assert noffset >= 0 And noffset < _filled Else "Buffer out of bounds" Return _buffer[noffset] End Method Method PeekShort:Int(noffset:Int) Assert noffset >= 0 And noffset-1 < _filled Else "Buffer out of bounds" Return (Short Ptr(_buffer+noffset))[0] End Method Method PeekInt:Int(noffset:Int) Assert noffset >= 0 And noffset-3 < _filled Else "Buffer out of bounds" Return (Int Ptr(_buffer+noffset))[0] End Method Method GrabBuffer:tbuffer() 'grabs the remaining bytes in the buffer and returns a new buffer Return cut(0,0) End Method Method GrabInt:Int() 'grabs an int from the start of the buffer and trims it Assert _filled >= 4 Else "Buffer out of bounds" 'get the return value Local temp_grab:Int = (Int Ptr(_buffer))[0] 'trim the buffer trimleft(4) Return temp_grab End Method Method GrabShort:Int() 'grabs an int from the start of the buffer and trims it Assert _filled >= 2 Else "Buffer out of bounds" 'get the return value Local temp_grab:Short = (Short Ptr(_buffer))[0] 'trim the buffer trimleft(2) Return temp_grab End Method Method GrabByte:Int() 'grabs an int from the start of the buffer and trims it Assert _filled >= 1 Else "Buffer out of bounds" 'get the return value Local temp_grab:Short = (Byte Ptr(_buffer))[0] 'trim the buffer trimleft(1) Return temp_grab End Method Method GrabString:String() 'grabs a string from the start of the buffer and trims it Assert _filled >= 4 Else "Buffer out of bounds" 'get the string size Local temp_size:Int = (Int Ptr(_buffer))[0] 'make sure buffer doesnt out of bounds Assert _filled >= 4 + temp_size Else "Buffer out of bounds" 'read the string Local temp_string:String = "" Local temp_i:Int For temp_i = 0 Until temp_size temp_string:+Chr(PeekByte(4+temp_i)) Next 'trim the buffer trimleft(4+temp_size) Return temp_string End Method Method AppendLine:Int(ntext:String) 'appends text not in a string format to the buffer 'add end of line to the text ntext :+ _eol Local temp_count:Int = ntext.length Local temp_i:Int = 0 'check if buffer needs resizing If _filled + temp_count > _size setcapacity(_filled + temp_count,True) 'read data from string into buffer For temp_i = 0 Until temp_count _buffer[_filled] = ntext[temp_i] _filled :+ 1 Next End Method Method AppendBuffer:Int(nbuffer:tbuffer) 'appends buffer onto the end of this buffer Assert nbuffer Else "Invalid buffer object" Local temp_i:Int = 0 'check if buffer needs resizing If _filled + nbuffer._filled > _size setcapacity(_filled + nbuffer._filled,True) 'read int data from buffer to this buffer For temp_i = 0 Until nbuffer._filled _buffer[_filled + temp_i] = nbuffer._buffer[temp_i] Next 'increase filled size of this buffer _filled :+ nbuffer._filled End Method Method AppendStream:Int(nstream:TStream,ncount:Int) 'appends X amount of data from the specified stream Assert nstream Else "Invalid stream object" Local temp_i:Int = 0 'check if buffer needs resizing If _filled + ncount > _size setcapacity(_filled + ncount,True) 'read data from stream into bank For temp_i = 0 Until ncount _buffer[_filled] = nstream.readbyte() _filled :+ 1 Next End Method Method AppendString:Int(ntext:String) 'appends a string to the buffer, in the format int(string length)+bytes(string data) Local temp_count:Int = ntext.length Local temp_i:Int = 0 'check if buffer needs resizing If _filled + 4 + temp_count > _size setcapacity(_filled + 4 + temp_count,True) 'append string length (Int Ptr(_buffer+_filled))[0] = temp_count _filled :+ 4 'read data from string into buffer For temp_i = 0 Until temp_count _buffer[_filled] = ntext[temp_i] _filled :+ 1 Next End Method Method AppendText:Int(ntext:String) 'appends text not in a string format to the buffer Local temp_count:Int = ntext.length Local temp_i:Int = 0 'check if buffer needs resizing If _filled + temp_count > _size setcapacity(_filled + temp_count,True) 'read data from string into buffer For temp_i = 0 Until temp_count _buffer[_filled] = ntext[temp_i] _filled :+ 1 Next End Method Method AppendInt:Int(nint:Int) 'appends an int into the buffer 'check if buffer needs resizing If _filled + 4 > _size setcapacity(_filled + 4,True) (Int Ptr(_buffer+_filled))[0] = nint _filled :+ 4 End Method Method AppendShort:Int(nshort:Short) 'appends an int into the buffer 'check if buffer needs resizing If _filled + 2 > _size setcapacity(_filled + 2,True) (Short Ptr(_buffer+_filled))[0] = nshort _filled :+ 2 End Method Method AppendByte:Int(nbyte:Byte) 'appends an int into the buffer 'check if buffer needs resizing If _filled + 1 > _size setcapacity(_filled + 1,True) (Byte Ptr(_buffer+_filled))[0] = nbyte _filled :+ 1 End Method Method FindString:Int(nfind:String="") 'this method will search for a string in the bank without having to make costly bank conversions Assert nfind Else "Must supply find parameter" Local temp_total:Int = nfind.length Local temp_count:Int = 0 Local temp_istart:Int = 0 Local temp_iscan:Int = 0 For temp_istart = 0 Until _filled - temp_total 'search for starting character of string If _buffer[temp_istart] = nfind[0] 'first character of the string was found so search rest of match temp_count = 1 For temp_iscan = 1 Until temp_total 'check for matching character If _buffer[temp_istart+temp_iscan] <> nfind[temp_iscan] Exit temp_count:+1 Next 'check if count of correct characters matches length of end of line If temp_count = temp_total Return temp_istart End If End If Next Return -1 End Method Method ToString:String() 'converts the data in the bank and returns as a string Local temp_data:String = "" Local temp_i:Int = 0 For temp_i = 0 Until _filled temp_data :+ Chr(_buffer[temp_i]) Next Return temp_data End Method End Type Function CreateBuffer:tbuffer(nsize:Int=0) Return tbuffer.Create(nsize) End Function
I have this piece of code that gets imported from a folder, rather then the modules folder. (this way i dont have to keep compiling it via bmk).
Now when i import this into my code file, i get this error along with a host of others
D:/blitzmax/dev/global/types/.bmx/tbuffer.bmx.debug.win32.x86.o(code+0x40): undefined reference to `__bb_audio_audio'
At no point in my program do i use any audio functions.
Anyone ?